Regular Expressions Cheatsheet
February 16, 2016
737
Regular Expressions
. matches any character, except for line breaks
matches 0 or more of the preceding character
? preceding character is optional, matches 0 or 1 occurancematched 1 or more of the preceding character
\d matches any single digit
\w matches any word character (字母,数字,下划线)
[XYZ] matches any single character from the character class
[XYZ]+ matches one or more any of the characters in the set
$ matches the end of the string
^ matches the beginning of the string
[^a-z] when inside of a character class, the ^ means NOT
matched anything that is NOT a lowercase letter
w{3} three w
\D non-digit
\S non-whitespace
\W non-alphanumeric
\b matches the boundary between a word and a non-word character