Regex Cheat Sheet
A cheat sheet of common regular expressions for when you have forgotten the syntax.
A complete regex cheat sheet — common regular expression syntax, quantifiers, flags and character classes with examples.
Steps and notes
What is Regex Cheat Sheet — Complete Regular Expression Reference?
Regex syntax is easy to forget precisely because it is dense: character classes, quantifiers, anchors and groups are all written in punctuation. This cheat sheet collects the constructs you actually reach for — ready-made patterns for emails, URLs and dates, the common character classes, and lookahead examples — so you copy a working starting point instead of rebuilding it from memory.
- Find the syntax you need by category
- Copy the fragment
- Verify it in the Regex Tester
- Syntax is JavaScript-flavoured (the \d, \w and [...] classes, and groups). Features such as lookbehind and named capture are engine-specific — test in the Regex Tester before assuming another language behaves the same
- This is a construct reference, not a full grammar: less common features such as atomic groups or possessive quantifiers are intentionally out of scope
Frequently asked questions
- Are these patterns production-ready?
- They are solid starting points for common cases. The classic example: fully RFC-compliant email validation is practically impossible in pure regex — the patterns here cover the pragmatic 99%, not the adversarial 1%.
- Will these patterns work in every language?
- The core syntax (classes, quantifiers, groups, anchors) is nearly universal. Advanced features like lookbehind or named groups vary by engine — verify JavaScript behavior in the Regex Tester.
- How do I adapt a pattern to my case?
- Copy it into the Regex Tester, paste a sample of your real text, then tighten the pattern until only the parts you want are highlighted.
Category: Development
Regex tools workflow
Regex Tester — JavaScript Regex Tester Online → Regex Cheat Sheet — Complete Regular Expression Reference