Regex Tester
Test regular expressions against sample text, with live matches, a replace mode, and Python/PCRE syntax support.
Processed locally in your browser. Nothing you enter is uploaded or stored.
- Matches highlighted inline as you type, with capture groups listed out.
- Replace mode shows the substituted output live, not just whether the pattern matches.
- Flavor selector translates Python/PCRE-specific syntax to JavaScript-compatible syntax, with a clear warning for anything that can't be safely translated (e.g. possessive quantifiers, atomic groups) rather than a silent, wrong result.
- A runaway-pattern time guard stops a catastrophic-backtracking pattern from freezing the tab — and covers Replace mode too, not just matching.
Why this is private
- Processed locally in your browser. Nothing you enter is uploaded or stored.
- Open your browser's DevTools → Network tab while using this tool — you won't see a request carrying your input, because it never leaves your device.
- Nothing you enter is uploaded to a server or shared with us — the processing happens entirely on your device.
Overview
Test a regular expression against sample text and see every match, capture group and flag behavior highlighted live — or switch to Replace mode to see exactly what a substitution would produce, using capture-group references like $1. A Flavor selector translates common Python/PCRE-specific syntax (named groups, leading inline flags, \A/\Z anchors, POSIX classes) so those patterns can be tested too.
How to use it
- 1Enter a pattern and choose flags (g, i, m, s).
- 2If your pattern uses Python or PCRE-specific syntax, pick that Flavor — the tool translates it and shows the exact pattern actually being tested.
- 3Paste test text.
- 4In Test mode, matches are highlighted inline and capture groups are listed below.
- 5Switch to Replace mode and enter a replacement (use $1, $2 for capture groups, $& for the whole match) to see the substituted output live.
Tips
- A pattern that runs for a long time on certain input may indicate catastrophic backtracking (ReDoS) — this tool applies a execution time guard and will stop runaway patterns, in both Test and Replace mode.
- The Flavor selector translates syntax, it doesn't run a real Python or PCRE engine — for the vast majority of patterns the translated result behaves identically, but a few PCRE-only features (possessive quantifiers, atomic groups) have no JavaScript equivalent and are flagged with a warning instead of guessed at.
Frequently asked questions
What people use it for
Build a validation patternIterate on a regex for an email, slug or ID format against real and edge-case samples.
Write an extraction patternDesign capture groups to pull fields out of a log line or URL.
Test a pattern written for Python's re moduleSwitch Flavor to Python to test patterns using (?P<name>...) named groups or \A/\Z anchors without rewriting them first.
Preview a find-and-replace before running it in codeSwitch to Replace mode to see the exact substituted output for your pattern and replacement string before pasting either into your editor or script.
Debug a regex that isn't matchingPaste the exact input and pattern to see where it fails.
Learn a regex featureTry lookahead, non-greedy quantifiers or named groups and see the effect live.
Related guides
- How to read JSON with a tree viewerA tree viewer turns a wall of brackets into a structure you can expand, search and copy paths from. Here's how to use one effectively.
- JSON parse errors explained: 'Unexpected token', 'Expected comma or brace', and the restWhat each common JSON error message actually means, the usual cause, and how to find the spot fast using line and column.
- How to format JSON (and actually understand the errors)JSON looks like a JavaScript object but follows stricter rules. Here's what those rules are and how to read the errors when they're broken.
Related tools
All developer toolsJSON ValidatorValidate JSON syntax and pinpoint errors instantly.Slug GeneratorConvert text into clean, URL-friendly slugs, with an optional length limit.JSON Viewer & FormatterView, format, validate, edit and beautify JSON with an interactive tree view, plus a shareable link.JSON MinifierStrip whitespace to compress JSON to its smallest size.
Ready to use Regex Tester?
Regex Tester