Characters

.Any character except newline
\wWord character [a-zA-Z0-9_]
\dDigit [0-9]
\sWhitespace
\WNon-word character
\DNon-digit
\SNon-whitespace

Quantifiers

*0 or more
+1 or more
?0 or 1 (optional)
{n}Exactly n times
{n,}n or more times
{n,m}Between n and m times

Anchors

^Start of string/line
$End of string/line
\bWord boundary
\BNon-word boundary

Groups & Lookaround

(abc)Capture group
(?:abc)Non-capturing group
(?=abc)Positive lookahead
(?!abc)Negative lookahead
a|bAlternation (or)

Character Sets

[abc]Match a, b, or c
[^abc]Not a, b, or c
[a-z]Range: a to z
[A-Z]Range: A to Z
[0-9]Range: 0 to 9

Flags

gGlobal (all matches)
iCase-insensitive
mMultiline
sDotall (dot matches \n)

Common Patterns

PatternDescription
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$Email address
^https?:\/\/[^\s]+$URL
^\d{3}-\d{3}-\d{4}$Phone (US)
^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$IPv4 address
^\d{4}-\d{2}-\d{2}$Date (YYYY-MM-DD)