Regex Cheat Sheet
Regex Cheat Sheet - a browser-based developer tools utility.
Browser tool
About Regex Cheat Sheet
A reference for regular expression syntax with an example beside each construct, for the moment you need a lookahead and cannot remember whether it is ?= or ?<= and which way round the negative form goes. Free to read online, with no account wanted, and any pattern you try is evaluated in the browser rather than uploaded.
How to use it
- Find the constructGrouped by what it does — anchors, character classes, quantifiers, groups, lookaround.
- Read the exampleEach entry shows the syntax doing something, which is faster to absorb than a definition.
- Check the flavourEngines differ. What works in JavaScript may not in POSIX grep, and vice versa.
Greedy, lazy, and the mistake everyone makes
Quantifiers are greedy by default: .* takes as much as it can and then gives back only what it must. Matching between two delimiters with .* therefore runs to the last one on the line rather than the first. Adding ? makes it lazy — .*? stops at the earliest match — and that single character resolves the majority of "why did my regex match too much" questions.
What it does not do
- A reference, not a tester. Check a pattern against real input in the environment that will run it.
- Regular expressions cannot parse nested structures. Using one on HTML or JSON works on your examples and fails on real data, which is the worst possible failure mode.
Questions people ask
- Why does my pattern match more than I expected?
- Greedy quantifiers. .* consumes as far as it can before backtracking, so a pattern meant to stop at the first delimiter runs to the last. Make it lazy with .*? or use a negated character class.
- Can I parse HTML with a regular expression?
- Not reliably, and the reason is structural rather than stylistic: regular expressions cannot count nesting depth. Use a parser. A regex will pass every test you write and break on the first real document.
Questions about ToolsVerse itself — privacy, cost, what happens to your files — are answered in the frequently asked questions.
Related tools
The tools people most often need alongside Regex Cheat Sheet.
Can’t find the tool you need?
Tell us what you’re looking for and we’ll consider adding it.