Regex Tester
Test patterns with live matches.
Runs entirely in your browser. Nothing you enter or upload leaves your device.
What the regex tester does
A regular expression, or regex, is a compact pattern that describes text: “a word followed by @”, “five digits at the end of a line”, and so on. They save a lot of code but are easy to get subtly wrong. This tester lets you write one, run it against sample text, and see every match and group straight away, before the pattern goes into your code.
It helps when you’re validating form input, pulling values out of log files, writing a find-and-replace for a code editor, or trying to understand a pattern someone else wrote. A quick reference panel lists the most-used syntax, from \d and \b to lookaheads and named groups.
How to use the regex tester
- Type a pattern and choose flags, such as g for all matches and i to ignore case.
- Paste the text to test. Matches are highlighted and each one is listed with its position and capture groups.
- Optionally type a replacement, using $1, $2 or $<name> for groups, to preview the result of a replace.
Understanding the results
Matches are highlighted in alternating shades, so neighbouring matches are easy to tell apart. The count above them tells you how many there are. Below, each match shows its starting position, counted in characters from zero, then every numbered and named group. A group marked “(not matched)” didn’t take part in that match, which often happens with optional groups or alternatives. Detail is listed for the first 100 matches.
Without the g flag only the first match is found, which is a common reason a pattern seems to “miss” text. If ^ and $ only match at the very start and end, turn on m so they work on each line. If . stops at line breaks, turn on s. When a pattern is invalid, the error appears under the flags, and when it runs too long you’ll see a warning that names nested quantifiers as the usual cause.
Questions
Which regex flavour is this?
JavaScript (ECMAScript), as built into your browser. It supports lookbehind, named groups and Unicode property escapes. PCRE, Python and Java differ in some details.
My page froze with other testers. Can that happen here?
Patterns run in a background worker and are stopped after 1.5 seconds, so a pattern with catastrophic backtracking shows a warning instead of locking the page.
Is my text sent anywhere?
No. Matching happens in your browser.
Do I type the slashes around the pattern?
No. Type only the pattern itself and pick flags with the buttons. Slashes you type are treated as literal characters. Use single backslashes too: write \d, not the doubled \\d you’d need inside a string in code.