</> ConvertAtlas Developer Tools
Patterns

Regex Cheatsheet

The building blocks of regular expressions, grouped so you can find the right symbol fast. Pair it with a live tester to confirm a pattern before trusting it.

Character classes

Any character except newline.
A digit; \D is any non-digit.
A word character (letter, digit, _); \W is the opposite.
Whitespace; \S is non-whitespace.
Any one of a, b or c.
Any character except a, b or c.
Any character in the range a to z.

Quantifiers

Zero or more of the preceding.
One or more.
Zero or one (optional).
Exactly n times.
n or more times.
Between n and m times.
Lazy versions — match as few as possible.

Anchors & boundaries

Start of the string (or line with m flag).
End of the string (or line with m flag).
Word boundary; \B is a non-boundary.

Groups & alternation

Capturing group.
Non-capturing group.
Named capturing group.
Match a or b.
Backreference to the first group.

Lookaround

Positive lookahead — followed by.
Negative lookahead — not followed by.
Positive lookbehind — preceded by.
Negative lookbehind — not preceded by.

Flags

Global — find all matches, not just the first.
Case-insensitive.
Multiline — ^ and $ match line starts/ends.
Dotall — . also matches newlines.