PHP extension text processing -- PCRE regular expression syntax 1 -- delimiter when using the PCRE function, the mode needs to be closed by the delimiter. The delimiter can be any non-alphanumeric, non-backslash, or non-blank character.
Frequently used delimiters are forward slashes (/), hash symbols (#), and reverse symbols (~). The following examples use valid delimiters.
/Foo bar/# ^ [^ 0-9] $ # + php + % [a-zA-Z0-9 _-] %
If the delimiter needs to be matched in the mode, it must be escaped using a backslash. If separators often appear in the mode, a better choice is to use other separators to improve readability.
/Http: \/# http ://#
You can use the preg_quote () function to escape a string to be used in the mode. its second parameter (optional) can be used to specify the separator to be escaped.
In addition to the separators mentioned above, you can also use the separators in the bracket style. the left and right brackets are used as the start and end separators respectively.
{This is a pattern}
You can add a pattern modifier to the end separator. The following example shows a case-insensitive match:
# [A-z] # I