Skip to main content

Regex Cheat Sheet

Character Classes

.
Any character except newline
\d
Digit (0-9)
\D
Non-digit
\w
Word character (a-z, A-Z, 0-9, _)
\W
Non-word character
\s
Whitespace (space, tab, newline)
\S
Non-whitespace

Anchors

^
Start of string
$
End of string
\b
Word boundary
\B
Non-word boundary

Quantifiers

*
Zero or more
+
One or more
?
Zero or one (optional)
{n}
Exactly n times
{n,}
n or more times
{n,m}
Between n and m times

Groups

(...)
Capturing group
(?:...)
Non-capturing group
(?=...)
Positive lookahead
(?!...)
Negative lookahead

Common Patterns

[a-zA-Z]
Any letter
[0-9]
Any digit
[a-zA-Z0-9]
Alphanumeric
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Email
^https?:\/\/[\S]+$
URL
^\d{4}-\d{2}-\d{2}$
Date (YYYY-MM-DD)

About the Regex Memo

A quick reference for regular expression syntax and common patterns. Look up character classes, quantifiers, and flags.

Browse by category or search for a specific pattern. Each entry includes syntax, description, and an example.

How to use

  1. Browse or search for a pattern.
  2. Read the syntax and example.
  3. Test patterns in our Regex Tester.