Regex Cheat Sheet
A searchable, printable regular-expression reference — character classes, anchors, quantifiers, groups, lookaround, flags and ready-made patterns. Free.
Character classes
12\d
\D
\w
\W
\s
\S
.
[abc]
[^abc]
[a-z]
[A-Za-z0-9]
[\d\s]
Anchors & boundaries
8^
$
\b
\B
\A
\z
\Z
\G
Quantifiers
11*
+
?
{n}
{n,}
{n,m}
*?
+?
??
{2,5}?
a++
Groups & backreferences
9(abc)
(?:abc)
(?<name>abc)
(?P<name>abc)
a|b
(red|blue)
\1
\k<name>
$1
Lookaround
6(?=abc)
(?!abc)
(?<=abc)
(?<!abc)
\d(?=px)
(?<=\$)\d+
Flags & modifiers
10g
i
m
s
u
x
y
(?i)
(?im)
(?i:abc)
Escapes & special chars
11\.
\\
\/
\t
\n
\r
\f
\0
\xFF
\x{00E9}
\Qabc\E
Common token shortcuts
10[0-9]
[a-fA-F0-9]
\d+
\w+
\s+
.*
.*?
[^\s]+
\b\w+\b
(?:\r\n|\n|\r)
Practical patterns
10^[\w.+-]+@[\w-]+\.[\w.-]+$
https?:\/\/[^\s]+
\b(?:\d{1,3}\.){3}\d{1,3}\b
#?[a-fA-F0-9]{6}\b
\d{4}-\d{2}-\d{2}
\+?\d[\d\s-]{7,}\d
[a-z0-9]+(?:-[a-z0-9]+)*
^\s+|\s+$
\s{2,}
<[^>]+>
Unicode properties
10\p{L}
\P{L}
\p{N}
\p{Lu}
\p{Ll}
\p{P}
\p{Sc}
\p{Han}
\p{Emoji}
\p{Greek}
No entry matches “:q”.
About Regex Cheat Sheet
This regex cheat sheet is a compact reference to regular expression syntax: character classes, anchors and boundaries, quantifiers, groups and backreferences, lookaround, flags and modifiers, escapes and special characters, common token shortcuts, practical ready-made patterns, and Unicode properties.
Regex is the definition of write-once syntax — the tokens are terse and easy to confuse, especially lookahead versus lookbehind, greedy versus lazy quantifiers, and the various group forms. Each row shows one token or pattern next to a plain-English description of what it matches.
The sheet ends with practical patterns you can copy outright, and like every cheat sheet here it is free and client-side: live search, a sticky table of contents, one-click copy on every token and a print button for a paper regex reference.
How to use Regex Cheat Sheet
- Skim the sections, from Character classes and Anchors & boundaries to Practical patterns and Unicode properties.
- Search for a token or concept like lookahead, \d or lazy to filter the sheet instantly.
- Jump to Practical patterns when you need a ready-made expression to adapt.
- Click a token or pattern, or its copy icon, to copy it into your code or a regex tester.
- Print the sheet — regex syntax is a classic thing to keep on paper.