Visual Reference

Regex
Explorer

/delimiter
^start anchor
(group open
\wword char
@literal @
[\w-]char class
+one or more
\.literal dot
[a-z]char range
{2,}2 or more
$end anchor
/delimiter
giflags

Hover any token above to see what it does. Every piece of a regular expression explained visually.

01 — Structure

Regex Anatomy & Decoder

Type any regex below — get it decoded piece by piece in plain English.

regex decoder — type any pattern to decode it
/ /
← type a regex to see it decoded
02 — Interactive

Live Regex Tester

Write a pattern, write test strings — see matches highlighted in real time.

live tester — matches highlight as you type
pattern
/ /
test string
matches highlighted
captured groups
03 — Building Blocks

Token Reference

Every token category — click any token to load it into the tester.

Anchors
^start of string/line^Hello
$end of string/lineworld$
\bword boundary\bcat\b
Character Escapes
\ddigit [0-9]\d{3}
\wword char [a-zA-Z0-9_]\w+
\swhitespace\s+
.any char except newlinea.c
Character Classes
[abc]any of a, b, c[aeiou]
[^abc]not a, b, or c[^0-9]
[a-z]char range a to z[a-f0-9]
Quantifiers
*0 or more (greedy)\d*
+1 or more (greedy)\w+
?0 or 1 (optional)colou?r
{n}exactly n times\d{4}
*?lazy (as few as possible)<.+?>
Groups & Alternation
(abc)capturing group(\d+)
(?:)non-capturing group(?:\d+)
a|balternation (or)cat|dog
Lookaround
(?=)positive lookahead\d(?= px)
(?!)negative lookahead\d(?! px)
04 — Quantifiers Deep Dive

Greedy vs Lazy

Greedy takes as much as possible. Lazy takes as little as possible.

greedy — .+ matches as much as possible
Pattern: <.+> — 1 match (whole thing)
lazy — .+? matches as little as possible
Pattern: <.+?> — 4 matches (each tag)
quantifier overview
*0 or more
a
a
+1 or more
a
a
?0 or 1
a
{3}exactly 3
a
a
a
{2,4}2 to 4
a
a
a
a
05 — Real World

Pattern Lab

Common real-world patterns, broken down token by token. Edit the test string to see matches live.

06 — Modifiers

Regex Flags

Flags change how the entire pattern behaves — global, case-insensitive, multiline, and more.

07 — Zero-Width Assertions

Lookaheads & Lookbehinds

These check what's around a match without consuming characters.

(?=...)Positive Lookahead
Match X only if followed by Y. Y is not included in the match.
\d+(?= dollars)
50 ← matched (followed by " dollars")
30 ← no match ("euros" not "dollars")
(?!...)Negative Lookahead
Match X only if NOT followed by Y.
\d+(?! dollars)
50 ← no match (IS followed by "dollars")
30 ← matched (NOT followed by "dollars")
(?<=...)Positive Lookbehind
Match X only if preceded by Y.
(?<=\$)\d+
100 ← matched (preceded by $)
(?<!...)Negative Lookbehind
Match X only if NOT preceded by Y.
(?<!\$)\d+
50 ← matched (NOT preceded by $)
08 — Quick Reference

Cheatsheet

Everything in one place.