Skip to main content

Toolzium

Command Palette

Search for a command to run...

Regex Cheat Sheet

Quick reference and interactive tester for regular expressions.

Regex Tester
Test your regex against custom text.
/
/
Results will appear here...
Cheat Sheet
Search and reference common regex patterns.

Character Classes

\dAny digit
e.g. 123
\wAny word character (alphanumeric & underscore)
e.g. a_B1
\sAny whitespace character
e.g.
\DAny non-digit
e.g. a
\WAny non-word character
e.g. !
\SAny non-whitespace character
e.g. a
.Any character except newline
e.g. x

Anchors

^Start of string
e.g. ^abc
$End of string
e.g. xyz$
\bWord boundary
e.g. \bword\b
\BNon-word boundary
e.g. word\B

Quantifiers

*0 or more
e.g. a*
+1 or more
e.g. a+
?0 or 1
e.g. a?
{n}Exactly n
e.g. a{3}
{n,}n or more
e.g. a{3,}
{n,m}Between n and m
e.g. a{3,5}

Groups & Lookahead

(abc)Capture group
e.g. (abc)
(?:abc)Non-capturing group
e.g. (?:abc)
(?=abc)Positive lookahead
e.g. a(?=b)
(?!abc)Negative lookahead
e.g. a(?!b)

Common Patterns

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$Email Address
e.g. test@example.com
^\+?[1-9]\d{1,14}$E.164 Phone Number
e.g. +1234567890
^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$URL
e.g. https://example.com
^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$IPv4 Address
e.g. 192.168.1.1
Regex Cheat Sheet & Tester | Toolzium - Toolzium