Regex Tester
Test regular expressions live with highlighted matches, capture groups, replace preview and a plain-English explanation.
Runs in your browser. Nothing is uploaded.
How to use the Regex Tester
- Type a regular expression in the pattern box, or press Load example.
- Turn flags on or off. g finds every match, i ignores case, and m makes ^ and $ work per line.
- Paste your test text on the left. Matches are highlighted on the right as you type.
- Open Matches & groups for each match's position and captured groups.
- Use Replace to preview a substitution, and Explanation to read the pattern in plain English.
Build and debug patterns with confidence
Regular expressions are compact and powerful, but they fail silently. A pattern that is slightly wrong either matches nothing or matches too much, and the only way to know is to try it. This tester runs your pattern against sample text as you type and highlights every match, so you can see immediately what it catches and what it misses.
Everything you need in one place
- Live highlighting of every match in your test text
- A match table with each match’s position and the value of every capture group, including named groups
- A replace preview that applies your replacement, with
$1,$<name>and$&support, to the whole text - A plain-English explanation that breaks the pattern into pieces, such as “a digit (0–9), exactly 4 times”, which is ideal for understanding a pattern someone else wrote
- Flag toggles with a short description of what each one does
Protected against runaway patterns
A badly written pattern can lock up a browser tab for minutes. Here, every pattern runs in a separate background worker with a time limit. If it takes too long, it’s stopped and you get a message explaining why, instead of a frozen page.
Practical uses
Validate the format of emails, phone numbers or postcodes before using a pattern in a form. Extract IDs, dates or amounts from logs and documents. Prepare a search-and-replace for your code editor. Or simply learn: change one part of a pattern at a time and watch how the matches change. Your patterns and text are remembered on this device for next time, and never sent anywhere.
Frequently asked questions
Which regex flavour does this use?
JavaScript's regular expressions (ECMAScript), as used in browsers and Node.js. Most everyday syntax is the same in Python, Java, C#, PHP and Go, but there are differences in advanced features such as lookbehind, named group syntax and Unicode classes. Check the documentation for the language you'll use.
Why does it say my pattern took too long?
Some patterns, typically nested quantifiers like (a+)+ on text that almost matches, cause catastrophic backtracking, where the engine tries an exponential number of paths. The tester runs your pattern in the background and stops it after a moment, so the page never freezes. Make the pattern more specific to fix it.
What's the difference between a match and a group?
The match is the whole text the pattern found. Groups are the parts inside parentheses, captured separately. For example, in (\d{4})-(\d{2}), group 1 is the year and group 2 the month. Named groups like (?<year>\d{4}) can be used by name in replacements.
How do I use groups in a replacement?
Write $1, $2 and so on for numbered groups, $<name> for named groups, and $& for the whole match. The Replace tab shows the result immediately.
Is my text sent anywhere?
No. Matching runs in your browser, in a background worker on your own device.
Tutorials
How to find and reformat dates with a regular expression
Use a regex with named groups to find DD/MM/YYYY dates in text and rewrite them in ISO 8601 (YYYY-MM-DD) format.