Regex Tester
Build and debug regular expressions live, with match groups. Stays in your browser.
Writing a regex is easy; trusting it is the hard part, and that's what this is for. Type a pattern, flip the flags you need, and every match lights up in your text as you go, with the capture groups and named groups broken out underneath. A broken pattern shows you the error instead of just doing nothing, and a few ready-made ones (email, IPv4, URL, date) give you somewhere to start. It's the JavaScript engine under the hood, the same one in your browser and in Node, so what works here works in your code. The pattern and the text stay in the page and reach no server, which is why we're happy to point real logs at it.
100% in your browser. Nothing you type ever leaves this page.
What you are actually looking at
The box highlights every span your pattern matches, live, as you type on
either side. Under it, each match is split into its capture groups, so a
pattern like (\w+)@(\w+\.\w+) hands you the local part and the
domain separately. It's the quickest way we know to confirm a regex does
what you think before it goes into code, where a wrong group index fails
quietly and you chase it for an hour.
Capture groups and named groups
Parentheses create a numbered group; (?:...) groups without
capturing, which keeps your indices clean. For anything you will read later,
name them: (?<user>\w+)@(?<host>\S+) lets your code
reach for match.groups.user instead of counting brackets. This
tool lists both numbered and named groups for each match.
It all stays local
The pattern and the text are matched in your browser and sent nowhere, so this is safe for real logs and sample data. If you need to pull values out of files at the command line instead, our grep guide covers the same ideas with a different tool.
Frequently asked questions
Which regex flavour does this use?
JavaScript (ECMAScript), because it runs in your browser. It is close to PCRE for everyday patterns, but a few things differ: no lookbehind on very old browsers, \A and \z are not supported (use ^ and $), and named groups use (?<name>...). For most validation and extraction work the difference never shows.
What do the flags do?
g matches all occurrences instead of just the first; i ignores case; m makes ^ and $ match at line breaks; s lets . match newlines; u turns on full Unicode; y anchors each match to the previous one. The g flag is on by default here so you see every match highlighted.
Why did my pattern freeze the page for a second?
Catastrophic backtracking. Patterns like (a+)+ on a long non-matching string make the engine try an exponential number of paths. The fix is almost always to make a quantifier possessive in spirit: avoid nested quantifiers, anchor what you can, and prefer specific character classes over .*
Is my test text sent anywhere?
No. The pattern and the text never leave your browser, the matching runs locally in JavaScript. Paste production logs or sample data without worry.