Regex Cheat Sheet
Character Classes
.Any character except newline
\dDigit (0-9)
\DNon-digit
\wWord character (a-z, A-Z, 0-9, _)
\WNon-word character
\sWhitespace (space, tab, newline)
\SNon-whitespace
Anchors
^Start of string
$End of string
\bWord boundary
\BNon-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
- Browse or search for a pattern.
- Read the syntax and example.
- Test patterns in our Regex Tester.