Regex Tester
Write a pattern, paste some text, and see every match highlighted with its capture groups. Runs entirely in your browser; nothing you type is ever sent anywhere.
Quick Learn
A regular expression describes a pattern of text — not a specific string, but a shape that many strings can match. /\d{4}-\d{2}-\d{2}/ doesn't match one date, it matches the *shape* of a date: four digits, a dash, two digits, a dash, two digits. That's what makes regex powerful for validation and extraction, and also what makes it easy to write a pattern that matches more (or less) than you intended.
Flags change how the pattern is applied, not what it matches: g finds every match instead of stopping at the first, i ignores letter case, m changes what ^ and $ anchor to, s lets . match newlines too. This tool highlights every match directly in your text and lists each match's capture groups, so you can see exactly what a pattern actually caught — including the parts you didn't mean to catch. Everything runs locally in your browser.
Best Practices
- •Turn on the g (global) flag to see every match, not just the first — its absence is one of the most common sources of "why did it stop after one result" confusion.
- •Named capture groups (?<year>\d{4}) are almost always more maintainable than positional ones ($1, $2) — they survive you reordering or adding groups later without breaking every reference to them.
- •A pattern that matches too much is usually missing an anchor (^, $) or is too greedy — try a more specific character class or a lazy quantifier (*?, +?) before reaching for a completely different pattern.
- •Very long test strings combined with certain nested-quantifier patterns (e.g. (a+)+b) can make matching slow due to backtracking — if a test hangs, simplify the pattern or shorten the test string first.
More Regex Tools
Regex Replace
Find and replace text using a regular expression, with backreferences.
Regex Explainer
Break down a regex pattern into plain-English tokens.
Common Patterns Library
Copy-ready regex patterns for email, URL, IPv4, and more.
Frequently Asked Questions
Want the engineering deep-dives behind tools like this one?