Preg_match regular functions, based on the Perl language
Preg_match (mode, string subject, array matches)
Elements included in the regular expression
(1), Atomic (ordinary character: A-Z-A-Z 0-9, Atomic table, escape character)
(2), metacharacters (with special function characters)
(3), pattern modifier (System built-in part of the characters I, M, S, U ...) )
"Atoms" in regular expressions
①a-z-A-Z _ 0-9 ///most common character
② (ABC) (SKD) ///with parentheses included units in accordance with
③[abcs] [^ABD]//with square brackets containing atomic tables, and ^ in atomic tables excluding or opposing content
④ escape character
\d contains all numbers [0-9]
\d except all numbers [^0-9]
\w contains all English characters [a-za-z_0-9]
\w Except for all English characters [^a-za-z_0-9]? \s contains blank areas such as carriage return, line break, paging, etc. [\f\n\r]
Regular expression meta-characters
* matches the previous 0 times 1 or more times
. Matches the content 0 times 1 or more times, but does not contain a carriage return line
+ match 1 or more times before the previous content
. 0 or 1 times to match previous content
| Select match similar to PHP | (because this operation conforms to a weak type leading to the most overall match)
^ Match string Header content
$ Match string tail content
\b Match word boundary, boundary can be a space or special match
\b Match exception with Word boundary unexpected content
{m} matches the previous content with a repeat number of M times
{m,} matches the previous content of the repeat number of times greater than equal
to M {m,n} matches the previous content of the repeat number of times M to N times
() merge the whole match, And put in memory, you can use \1 \2 ... Sequentially get
Appendix: Full symbolic interpretation of regular expressions
Http://www.cnblogs.com/yirlin/archive/2006/04/12/373222.html