NimbleTools

Regex Cheat Sheet & Builder

Regular expressions reference: anchors, classes, quantifiers, groups and flags with examples, plus ready recipes (email, URL, IP) and a live tester with highlighting.

Flags
Matches: 2
Contact me at user@example.com or admin@test.org!
Common recipes
Anchors
^Start of string
$End of string
\bWord boundary
\BNot a word boundary
Character classes
.Any character except newline
\dDigit (0-9)
\DNot a digit
\wWord character (letter, digit, _)
\WNot a word character
\sWhitespace (space, tab, newline)
\SNot whitespace
[abc]Any of a, b or c
[^abc]Any character except a, b, c
[a-z]Any character in range a-z
Quantifiers
*Zero or more
+One or more
?Zero or one (optional)
{n}Exactly n times
{n,}n or more times
{n,m}From n to m times
*?Lazy: as few as possible
Groups & references
(abc)Capturing group
(?:abc)Non-capturing group
(a|b)Alternation: a or b
(?<name>…)Named group
\1Backreference to group 1
(?=…)Lookahead: followed by
(?!…)Negative lookahead
Flags
gGlobal: all matches
iIgnore case
mMultiline: ^ $ per line
sDot matches newline
uUnicode mode
ySticky: from lastIndex only
regex

Frequently asked questions

How do I read a regex?

Start from the left: each token matches one thing — ^ is string start, \d is a digit, + means "one or more". Click any token here to add it to your pattern.

What flags should I use?

g finds all matches, i ignores case, m makes ^ and $ match line starts/ends, s lets . match newlines, u enables Unicode mode.

How do I test an email pattern?

Choose the Email recipe, paste your text into the test field and see highlighted matches and their count immediately.