文档介绍:Anchors Quantifiers Groups and Ranges
^\A Start of string *+ 01 or more . Anynew characterline (\n) except
$ End of string ? 0 or 1 (a|b) a or b
\Z End of string {3} Exactly 3 (...) Group
\b Word boundary {3,} 3 or more (?:...) Passive Group
\B Not word boundary {3,5} 3, 4 or 5 [abc] Range (a or b or c)
\< Start of word [^abc] Not a or b or c
\> End of word [a-q] Letter between a and q
[A-Q] Upper case letter
Quantifier Modifiers
between A and Q
[0-7] Digit between 0 and 7
Character Classes "x"x? below representsUngreedy a quantifier version of "x"
\n nth group/subpattern
Note: Ranges are inclusive.
\c\s ControlWhite space character
\S Not white space Escape Character
\d Digit
Pattern Modifiers
\D Not digit \ Escape Character
\w Word
gi
\W Not word GlobalCase-insensitive match
m
\x Hexadecimal digit Metacharacters (must be escaped) Multiple lines
s
\O Octal digit Treat string as single line
^$ [{ .* x ments and
( \ + white space in pattern
) | ? e Evaluate replacement
POSIX
< > U Ungreedy pattern
[:upper:][:lower:] UpperLower case letters
[:alpha:] All letters
[:alnum:] Digits and letters Special Characters String Replacement (Backreferences)
[:digit:] Digits
[:xdigit:] Hexadecimal digits \n\r NewCarriage line return $n$2 nth"xyz" non-passive in /^(abc(xyz))$/ group
[:punct:] Punctuation \t Tab $1 "xyz" in