A comprehensive regex cheatsheet for developers at any level. Each section covers a category of common patterns — anchors, character classes, quantifiers, groups, and real-world patterns for email, URL, phone, and date matching — with clear explanations and examples you can test live in the Regex Tester.
Covers anchors, quantifiers, groups, and character classes
Real-world patterns with plain-English explanations
Click any pattern to test it live in the tester
Developer Tool
All processing happens in your browser — your files are never uploaded to any server.
🚀Open Regex Tester100% Free · No account · Works on any device
Browse the cheatsheet below, then click any pattern to load it into the Regex Tester and test it against your own data.
Step-by-step guide to regex cheatsheet — common patterns and what they mean:
Anchors: ^ and $
^ matches the start of a string (or line with the m flag). $ matches the end. Use them together — ^pattern$ — to match an entire string rather than a substring.
Character classes: [abc] and \d \w \s
[abc] matches any one of a, b, or c. \d matches any digit (0–9). \w matches word characters (letters, digits, underscore). \s matches whitespace. Their uppercase inverses (\D, \W, \S) match the complement.
Quantifiers: *, +, ?, {n,m}
* means zero or more. + means one or more. ? means zero or one (optional). {n} means exactly n times. {n,m} means between n and m times. Add ? after any quantifier (e.g. *?) to make it lazy (match as few as possible).
Groups: () and (?:)
(abc) captures a group and lets you reference it with \1 or in replace strings. (?:abc) groups without capturing — useful when you need grouping for alternation or quantifiers but do not need the value.
Lookahead and lookbehind
(?=...) is a positive lookahead — matches a position followed by the pattern. (?!...) is a negative lookahead. (?<=...) is a positive lookbehind. (?<!...) is a negative lookbehind. These do not consume characters.
More use-case guides for the same tool:
Open the full Regex Tester — free, no account needed, works on any device.
Open Regex Tester →Free · No account needed · Works on any device