Look up regex syntax fast. Search or browse anchors, character classes, quantifiers, groups, lookarounds, flags and escapes — each with a plain-English meaning and an example — and open any example in the Regex Tester with one click to see it match. Every example is tested to work. It's free and runs in your browser.
| Token | Means |
|---|---|
| ^ $ | Start / end |
| \d \w \s | Digit, word character, whitespace |
| * + ? {n,m} | Quantifiers |
| ( ) (?: ) (?<n> ) | Groups |
| (?= ) (?! ) (?<= ) (?<! ) | Lookarounds |
| g i m s u y | Flags |
* is greedy and matches as much as possible; *? is lazy and stops at the first chance. <.+?> matches one tag; <.+> would swallow everything to the last >.
Wrap it in word boundaries: \bcat\b matches cat but not concat.
Yes, in all current browsers. Safari added them in version 16.4, so very old Safari lacks them.
Mostly. Named groups are (?P<name>…) in older Python, and flags are set differently, but anchors, classes, quantifiers and lookarounds behave the same.
Yes — Try it opens the Regex Tester with the pattern and sample filled in.
The cheatsheet covers the syntax used every day — anchors and word boundaries, character classes including Unicode property escapes, greedy and lazy quantifiers, capturing, non-capturing and named groups with back-references, alternation, the four lookarounds, every JavaScript flag, and character escapes — each with a one-line meaning, an example pattern and a sample string. Every example is part of the site's automated tests: each pattern is compiled with its flags and checked to match its own sample, so the reference can't drift into examples that don't work. Search filters across tokens, meanings and examples. The Try it link opens the Regex Tester with the pattern, flags and sample already filled in, so you can edit them and watch the matches change. Examples use JavaScript syntax, and the page notes where other engines differ, such as \p{…} needing the u flag and lookbehind being missing from some older engines.