Skip to main content
FreeOnlineTools Go
English

Regex Cheatsheet

Comprehensive regular expression cheatsheet with character classes, anchors, quantifiers, groups, and common patterns. Free, private, browser-based.

Local processing

Character Classes

.Any character except newline
\dDigit [0-9]
\DNon-digit
\wWord char [a-zA-Z0-9_]
\WNon-word char
\sWhitespace
\SNon-whitespace
[abc]Any of a, b, c
[^abc]Not a, b, or c
[a-z]Range a to z
[a-zA-Z0-9]Alphanumeric

Anchors

^Start of string
$End of string
\bWord boundary
\BNon-word boundary
^$Empty string

Quantifiers

*0 or more
+1 or more
?0 or 1 (optional)
{n}Exactly n
{n,}n or more
{n,m}Between n and m
*?Lazy 0+ (non-greedy)
+?Lazy 1+ (non-greedy)

Groups & Alternation

(abc)Capture group
(?:abc)Non-capturing group
(?<name>abc)Named group
\1Backreference to group 1
\k<name>Backreference to named group
a|bAlternation (a or b)

Lookarounds

(?=abc)Lookahead: followed by abc
(?!abc)Negative lookahead
(?<=abc)Lookbehind: preceded by abc
(?<!abc)Negative lookbehind

Unicode & Flags

/iCase-insensitive
/gGlobal (all matches)
/mMultiline (^/$ match line bounds)
/sDotall (. matches newline)
/uUnicode mode
/ySticky (match at lastIndex)
\p{L}Unicode letter
\p{N}Unicode number
\p{Emoji}Unicode emoji

Common Patterns

^[\w.+-]+@[\w-]+\.[\w.-]+$Email (simple)
^https?://[\w.-]+\.[a-z]{2,}URL (simple)
^\d{4}-\d{2}-\d{2}$Date YYYY-MM-DD
^\d{3}-\d{2}-\d{4}$SSN format
^(\+\d{1,3})?\s?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$Phone number
^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$Hex color
^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$IPv4 address
^[a-f0-9]{32}$MD5 hash
^[a-f0-9]{40}$SHA-1 hash
^[a-f0-9]{64}$SHA-256 hash

What is Regex Cheatsheet?

A regular expression (regex) is a pattern that describes a set of strings. This cheatsheet covers the JavaScript regex syntax: character classes, anchors, quantifiers, groups, lookarounds, and common practical patterns.

How It Works

The tool displays a searchable, categorized reference of regex syntax with descriptions and examples. A filter input narrows results by syntax or description.

Common Use Cases

  • Quick regex syntax lookup
  • Learning regular expressions
  • Finding common regex patterns for validation

Technical Details

Static reference data for JavaScript regex flavor (ES2024). Includes PCRE-compatible features supported in JS: lookbehind, named groups, unicode property escapes (\p{...}), and the /v flag for set operations.

How to Use

  1. Browse syntax by category
  2. Use the filter box to search
  3. Copy any pattern with the copy button

Privacy

All processing happens in your browser. Your data is never uploaded to any server.

FAQ

Which regex flavor is covered?

JavaScript (ES2024) regex flavor, including lookbehind, named groups, unicode property escapes, and the /v flag.

Can I search for specific patterns?

Yes. Use the filter box to search across all syntax entries and common patterns.

Related Tools