Free Utilities
Free Utilities

Regex Cheat Sheet

Character Classes

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

Quantifiers

*Zero or more
+One or more
?Zero or one
{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

Groups & Lookaround

(abc)Capture group
(?:abc)Non-capturing group
(?<name>abc)Named group
a|bAlternation (a or b)
(?=abc)Positive lookahead
(?!abc)Negative lookahead

Character Sets

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

Flags

gGlobal (all matches)
iCase-insensitive
mMultiline
sDotall (dot matches newline)