Why does the regular expression start and end with @? The slash in the middle is not escaped, but can be used. No error is reported? {Code...} Why is the regular expression used?
@The slash in the beginning and end is not escaped, but can be used. No error is reported?
If (! Preg_match ('@ ^ https? : // @ ', $ Url) {die ('HTTP (s) only .');}
Reply content:
Why is the regular expression used?@The slash in the beginning and end is not escaped, but can be used. No error is reported?
If (! Preg_match ('@ ^ https? : // @ ', $ Url) {die ('HTTP (s) only .');}
PHP regular expressions can be defined by yourself. You can also use other expressions, such#,|And so on.
When using the PCRE function, the mode needs to be closed by the separator. The delimiter can be any non-alphanumeric, non-backslash, or non-blank character.
Frequently Used delimiters are forward slashes (/), hash symbols (#), and reverse symbols (~).
-Separator
The regular strap-type delimiters can be customized. Go to the manual.