php positive expression is shown delimiter

 

Before the regular expression shown in the study, we need to learn positive expression delimiter is shown.

Delimiter, a boundary is set, that is, the regular expression has been shown within the boundary.

PHP regular expression shown delimiter defined as follows:

Delimiter, you can not use a-zA-Z0-9 \ others can be used. It must be paired with a start there is an end. Marble mechanical components repair

Let cases a few examples:

example Explanation
/ Write regular middle / correct
Middle to write regular $ $ correct
% Intermediate to write regular% correct
^ ^ Middle to write regular correct
@ @ Middle to write regular correct
(Middle to write regular) error
A middle write regular A error

Note: \ is the escape character, if the regular expression shown in the later need to match the inside / below:

/ / /

This time we really want to match / when the need to put inside the delimiter / escape it with the escape character, written in the following example:

/ \/ /

If you do not bother to meet this need the escape character when you can put two forward slashes (/ /) delimited, instead of the other delimiters (##).

Guess you like

Origin www.cnblogs.com/furuihua/p/12073123.html
Recommended