DevTools Hub

Search tools

Search for a developer tool

Development

Regex Cheat Sheet Generator

Build a custom JavaScript regex syntax reference and export it as Markdown or plain text.

Sections to include
Character classes
.Any character except a line break
\dAny digit (0-9)
\DAny non-digit character
\wAny word character (letter, digit, underscore)
\WAny non-word character
\sAny whitespace character
\SAny non-whitespace character
[abc]Any one of a, b, or c
[^abc]Any character except a, b, or c
[a-z]Any character in the range a to z
Anchors & boundaries
^Start of the string (or line, with the m flag)
$End of the string (or line, with the m flag)
\bWord boundary
\BNot a word boundary
Quantifiers
*Zero or more times
+One or more times
?Zero or one time (optional)
{n}Exactly n times
{n,}n or more times
{n,m}Between n and m times
*? +? ?? {n,m}?Lazy versions — match as few as possible
Groups & references
(...)Capturing group
(?:...)Non-capturing group
(?<name>...)Named capturing group
\1, \2, ...Backreference to capturing group N
\k<name>Backreference to a named group
|Alternation (OR) between two options
Lookaround
(?=...)Lookahead — must be followed by, not consumed
(?!...)Negative lookahead — must not be followed by
(?<=...)Lookbehind — must be preceded by, not consumed
(?<!...)Negative lookbehind — must not be preceded by
Flags
gGlobal — find all matches instead of stopping at the first
iCase-insensitive matching
mMultiline — ^ and $ match the start/end of each line
sDot matches newline characters too
uTreats the pattern as a sequence of Unicode code points
ySticky — matches only from lastIndex, not anywhere after it
Escaping special characters
\. \* \+ \? \( \) \[ \] \{ \} \^ \$ \| \\Escape any of these to match the literal character instead of its special meaning
Common ready-made patterns
[\w.+-]+@[\w-]+\.[\w.-]+Email address
https?:\/\/[\w.-]+(?:\/[\w\-./?%&=]*)?URL (http/https)
(?:\d{1,3}\.){3}\d{1,3}IPv4 address
#[0-9a-fA-F]{6}\bHex color
\d{4}-\d{2}-\d{2}ISO date (YYYY-MM-DD)
\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}US-style phone number

A reference you can actually keep

Most regex cheat sheets are one-size-fits-all — a wall of every token you might ever need, whether you're working with lookaround or not. This one lets you pick the sections that matter for what you're doing, filter down to a specific token or keyword, and export exactly that as Markdown, plain text, or a downloadable .md file to keep in your notes or drop into a team wiki.

The reference covers character classes, anchors, quantifiers, groups and backreferences, lookaround, flags, escaping, and a handful of ready-made patterns for things like email addresses and IPv4 addresses — all JavaScript RegExp syntax, matching the engine every other regex tool on this site uses.

Pairing it with the other regex tools

Once you've got the syntax down, the Regex Builder lets you assemble a pattern by clicking instead of typing it from memory, the Regex Tester runs a pattern against sample text with live match highlighting, and the Regex Visualizer breaks an existing pattern down into a diagram so you can see its structure at a glance. If a pattern isn't behaving the way you expect, the Regex Debugger steps through a match attempt piece by piece.

FAQ

Does this cover other regex flavors, like PCRE or Python's re?

No — this reference (and every regex tool on this site) is specifically JavaScript RegExp syntax. Most of it overlaps heavily with other flavors, but details like lookbehind support and flag letters vary between languages.

Does the filter affect what gets exported?

No — the filter only narrows what's shown on this page so you can find a token quickly. Copying or downloading always exports the full content of whichever sections are checked above, regardless of the current filter text.

Related tools