Character Classes
.Any character except newline
\dDigit (0-9)
\DNot a digit
\wWord character (a-z, A-Z, 0-9, _)
\WNot a word character
\sWhitespace (space, tab, newline)
\SNot whitespace
[abc]Any of a, b, or c
[^abc]Not a, b, or c
[a-z]Character range
Anchors
^Start of string
$End of string
\bWord boundary
\BNot word boundary
Quantifiers
*0 or more
+1 or more
?0 or 1
{n}Exactly n times
{n,}n or more times
{n,m}Between n and m times
Groups
(abc)Capture group
(?:abc)Non-capturing group
(?<name>abc)Named capture group
\1Backreference to group 1
Alternation
a|ba or b
Flags
gGlobal - find all matches
iCase insensitive
mMultiline
sDot matches newline
uUnicode
ySticky