Home Tools Blog About

Regex Cheat Sheet

In short

A searchable quick reference for regular expression tokens, with what each one matches.

  • Runs in your browser
  • Nothing uploaded
  • Free, no sign-up

A quick reference for regular expressions. Find the common tokens for character classes, anchors, quantifiers, groups, and flags, each with its meaning and a short example. Use the search box to filter the rows. Runs entirely in your browser.

Character classes

TokenMeaningExample
.Any character except newlinea.c
\dA digit (0-9)\d\d
\DNot a digit
\wWord character (a-z, A-Z, 0-9, _)
\WNot a word character
\sWhitespace
\SNot whitespace
[abc]Any of a, b, or c
[^abc]Not a, b, or c
[a-z]Any lowercase letter

Anchors and boundaries

TokenMeaningExample
^Start of string or line^Hello
$End of string or lineend$
\bWord boundary\bcat\b
\BNot a word boundary

Quantifiers

TokenMeaningExample
*0 or morea*
+1 or morea+
?0 or 1 (optional)a?
{n}Exactly n timesa{3}
{n,}n or morea{2,}
{n,m}Between n and ma{2,4}
*?Lazy: as few as possible

Groups and alternation

TokenMeaningExample
(abc)Capturing group
(?:abc)Non-capturing group
(?<name>...)Named group
a|ba or bcat|dog
\1Backreference to group 1

Flags

TokenMeaningExample
gGlobal (find all matches)
iCase insensitive
mMultiline (^ and $ per line)
sDotall (. matches newline)
uUnicode
ySticky
🛡
100% PrivateNo server uploads, ever
InstantRuns in your browser
💧
No WatermarksClean output, always
🆓
Free ForeverNo accounts, no limits

How to Use Regex Cheat Sheet

Regex Cheat Sheet · free online tool · All Tools Verse
Regex Cheat Sheet. Free online tool that runs in your browser.
  1. Browse the reference. Tokens are grouped by what they do.
  2. Search to filter. Type to narrow down to the token you need.
  3. Read the meaning. Each token shows what it matches with an example.
  4. Use it in your pattern. Copy the token into your own regular expression.

Frequently Asked Questions

What does it cover?

The common regular expression tokens for character classes, anchors, quantifiers, groups, and escapes, each with a short explanation.

Can I search it?

Yes. Type in the search box to filter the reference down to the tokens that match what you are looking for.

Which flavor of regex is this?

It follows the JavaScript regular expression syntax, which is close to most other common engines.

Is anything uploaded?

No. The reference runs entirely in your browser, so nothing leaves the tab.

Is it free?

Yes. Every tool here is free to use with no sign up.

Keep going

Related Tools

All Developer tools →
Share

Embed this tool

Add this free tool to your website. Copy and paste the code: