Regex Cheat Sheet

← Developer Tools

A compact JavaScript-oriented regex reference for common tokens, anchors, groups and quantifiers.

DeveloperRegex ReferenceHistorical URL preserved

Common regex tokens

PatternMeaning
.Any character except line terminators unless dotAll is enabled
dDigit
wWord character in JavaScript’s basic character class
sWhitespace
^ / $Start / end anchors
[abc]One character from a set
[^abc]One character not in a set
* / + / ?0+ / 1+ / optional repetitions
{n,m}Repeat from n to m times
(...)Capturing group
(?:...)Non-capturing group
a|bAlternation
bWord boundary

Useful JavaScript flags

g global, i case-insensitive, m multiline, s dotAll, u Unicode mode and y sticky matching.

Flavor matters

Regex syntax differs across JavaScript, PCRE, Python, .NET and other engines. Test patterns in the engine where they will actually run.

Related tools