Online Tool Store Online Tool Store

Regex Cheat Sheet

Browse and search common regular expression tokens — character classes, anchors, quantifiers, groups, and flags — each with a short example. Runs entirely in your browser.

🔒 This tool runs entirely in your browser. Your files are never uploaded to a server.

Character classes

.

Any character except newline

a.c matches "abc", "a1c"

\d

Any digit (0-9)

\d+ matches "123"

\D

Any non-digit

\D+ matches "abc"

\w

Word character (letter, digit, underscore)

\w+ matches "hello_1"

\W

Non-word character

\W matches "!", " "

\s

Whitespace (space, tab, newline)

\s+ matches " "

[abc]

Any one of a, b, or c

[abc]+ matches "cab"

[^abc]

Any character except a, b, or c

[^abc] matches "d"

[a-z]

Any lowercase letter

[a-z]+ matches "hello"

Anchors

^

Start of string (or line, with the m flag)

^Hello matches "Hello world"

$

End of string (or line, with the m flag)

world$ matches "Hello world"

\b

Word boundary

\bcat\b matches "a cat sat" not "concatenate"

Quantifiers

*

Zero or more

ab*c matches "ac", "abc", "abbbc"

+

One or more

ab+c matches "abc" not "ac"

?

Zero or one

colou?r matches "color" and "colour"

{n}

Exactly n times

\d{3} matches "123"

{n,}

n or more times

\d{2,} matches "12", "123"

{n,m}

Between n and m times

\d{2,4} matches "12" to "1234"

Groups & alternation

(abc)

Capturing group

(ab)+ captures repeated "ab"

(?:abc)

Non-capturing group

(?:ab)+c groups without capturing

(?<name>abc)

Named capturing group

(?<year>\d{4}) captures as "year"

a|b

Match a or b

cat|dog matches "cat" or "dog"

Flags

g

Global — find all matches, not just the first

/a/g

i

Case-insensitive

/hello/i matches "HELLO"

m

Multiline — ^ and $ match line boundaries

/^a/m

s

Dot matches newline too

/a.b/s

How it works

  1. Browse tokens grouped by category — character classes, anchors, quantifiers, groups, and flags.
  2. Search to filter to the token or concept you need.
  3. Each entry includes a short example of what it matches.

FAQ

Is this specific to one programming language?

It covers the common syntax shared across most modern regex flavors (JavaScript, Python, PCRE). A handful of features (like named groups) vary slightly in exact syntax between languages.

Can I test these patterns live?

Not on this page — pair it with Regex Tester to try any of these tokens against your own text.

Is my search query sent anywhere?

No — filtering happens entirely in your browser.

How we compare

Feature Online Tool Store Searching each time online Memorizing syntax
Everything on one searchable page
No ads or unrelated results

Searching for regex syntax each time you forget it wastes time. Regex Cheat Sheet keeps the common tokens in one searchable page.

Explore related tools

Embed this tool

Paste this on your own site — it stays free, and every file still stays in your visitor's browser, not yours or ours.