ilovekit

Regex Cheatsheet

6 tools

Common regex patterns and what they mean.

Runs in your browser — your files and text stay on your device

A quick reference of common regex patterns and what each one means, covering character classes, quantifiers, anchors and groups. Use it to look up syntax while you build a pattern. Flavors differ slightly between languages, so confirm in your target environment.

Regex TesterCheatsheetFind & ReplaceMatch BreakdownPlain-English ExplainerCommon Patterns Library
\dAny digit (0-9)
\DAny non-digit
\wAny word character (letters, digits, underscore)
\WAny non-word character
\sAny whitespace character
\SAny non-whitespace character
^Start of string/line
$End of string/line
.Any character except newline
.*Zero or more of any character
.+One or more of any character
?Zero or one of the preceding token
[a-z]Any lowercase letter a through z
[^a-z]Any character that is NOT a-z
(?:...)Non-capturing group
(...)Capturing group
\bWord boundary
\BNot a word boundary
{n,m}Between n and m repetitions
{n,}n or more repetitions
a|bMatches a or b
\b\w+@\w+\.\w+\bSimple email pattern
https?:\/\/\S+URL pattern (http or https)
^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$IPv4 address pattern

Frequently asked questions

What is a regular expression?

A pattern of characters used to match, search, or validate text.

How do I test one of these patterns?

Copy it, switch to the Regex Tester tab, and paste it into the pattern field.

Guides

All guides →