Every regex token, class, and pattern — searchable and testable.
Live Regex Tester
Preview3 matches
The quick brown fox jumps over the lazy dog
55 tokens across 7 categories · JavaScript (ECMAScript) regex syntax · flags may vary by engine
A regex cheatsheet is an essential reference for developers writing regular expressions in JavaScript, Python, or any other language. This tool covers every major regex token — anchors like ^ and $, character classes like \w and \d, quantifiers, capturing groups, lookaheads, flags, and ready-to-use common patterns. All entries are searchable by name or keyword, and a live tester lets you validate patterns instantly.
A quantifier controls how many times the preceding element must match. Common quantifiers include * (zero or more), + (one or more), ? (zero or one), {n} (exactly n times), and {n,m} (between n and m times). Append ? to any quantifier to make it lazy (match as few characters as possible).
A capturing group (abc) stores the matched text so you can reference it with back-references like \1 or $1 in replacements. A non-capturing group (?:abc) groups tokens for quantifiers or alternation without storing the match, which is slightly more efficient when you don't need the captured value.
Without the global flag, a regex match stops after the first occurrence. With /g, the engine finds every non-overlapping match in the string. Use it with String.matchAll(), String.replaceAll(), or a while loop with RegExp.exec() to iterate over all results.
Lookaheads are zero-width assertions — they check whether a pattern exists ahead of the current position but do not consume any characters. A positive lookahead (?=abc) asserts the text ahead matches; a negative lookahead (?!abc) asserts it does not. This lets you match text only when it is (or isn't) followed by something specific.