Regex Tester
Live regex matching with highlighted results, capture groups and a replace preview. 100% free, no signup. Everything runs in your browser.
Loading the tool…
Type a pattern, paste your test text, and this regex tester highlights every match live as you edit, with numbered capture groups broken out per match and a replace preview showing exactly what your $1 substitutions will produce. A cheat sheet of common patterns for emails, URLs, dates and phone numbers inserts with one click when you want a starting point instead of a blank field.
It runs the JavaScript regex engine locally in your browser, so your test text never leaves your machine. That matters, because the text people test against is so often production data.
How to use
- Enter your regular expression in the pattern field.
- Set the flags you need, like g for global or i for case-insensitive.
- Paste or type your test text.
- Read the highlighted matches and the numbered capture groups listed for each one.
- Add a replacement string with $1 and $2 references to preview the substitution result.
- Or click a cheat sheet pattern for emails, URLs, dates or phone numbers, insert it, and adjust from there.
Why use our regex tester?
Live highlighting changes how you write regex. Instead of the write, run, squint, edit loop, you watch matches appear and vanish with every character you type, so the moment a quantifier goes greedy or an anchor kills everything, you see it happen. Half of regex skill is fast feedback, and fast feedback is really all this page is.
Numbered capture groups per match are here because groups are where regex graduates from matching to extracting. Once you can see that group 1 caught the area code and group 2 caught the rest, wiring the pattern into code, or into the replace field with $1 and $2, becomes mechanical instead of guesswork.
It uses the JavaScript engine, and I say so up front precisely because regex flavors differ. Lookbehind, named groups and Unicode escapes behave the way MDN's regular expressions guide documents, which is ideal if your pattern is headed for JavaScript or TypeScript, and close but not identical for Python, Go or PCRE. A tester that will not tell you its engine is quietly setting you up.
About the cheat sheet, an honesty note: the email pattern is a practical one, not a perfect one, because a truly complete email regex is a famous monster and the real answer to validating an address is sending mail to it. I would rather hand you a solid starting pattern and say that plainly than pretend one line of regex settles a standards document.
Regex work rarely travels alone. The text cleaner handles the boring normalization that often removes the need for a clever pattern in the first place, text compare shows what your replacement actually changed, and the JSON formatter makes API payloads readable before you go pattern-fishing inside them.
Who is this tool for?
Developers use it to build and verify patterns before they ship: input validation, log parsing, route matching, redaction rules. Testing against a dozen realistic samples here takes two minutes and catches the edge case, the empty string, the trailing whitespace, the uppercase variant, that would otherwise become Thursday's bug report.
The replace preview earns its keep before any risky bulk edit. Compose your find-and-replace with backreferences here, run it against a sample of the real text, and confirm the output before unleashing the same pattern on 400 files in your editor. Reordering names, reformatting dates and rewriting URLs are all two-group, one-preview jobs.
Data cleaning is the non-glamorous workhorse: pulling emails out of a copy-pasted contact dump, extracting order numbers from support tickets, finding every date in a report. The cheat sheet covers the common shapes and the highlighting shows immediately which rows your pattern missed.
And it works as a learning tool. If you are studying for interviews or just finally learning regex properly, insert a cheat sheet pattern, break it on purpose, and watch what each change does to the matches. That loop teaches more per minute than any tutorial I have read.
Frequently asked questions
JavaScript, exactly as your browser implements it. Patterns behave identically in Node and browser code. Most syntax carries over to Python, Go and PCRE, but details like lookbehind support and escape handling differ, so always retest in the destination language.
The usual suspects: an unescaped special character like a dot or plus doing something you did not intend, an anchor pinning the match to the wrong place, or a case mismatch fixed by the i flag. Delete the pattern and rebuild it a few characters at a time while watching the highlights.
They are backreferences to your numbered capture groups. If your pattern captures a first and last name in groups 1 and 2, a replacement of $2, $1 swaps them. The preview shows the substituted output live, so there is no mystery about what will happen.
No, and anyone selling one has not read the spec. The address grammar in the RFCs allows things no simple pattern captures. The cheat sheet pattern matches the addresses real people actually type, which is the sensible goal. True validation means sending a confirmation email.
The ones you will use constantly: g finds all matches instead of stopping at the first, i ignores case, m makes the anchors work per line, and s lets the dot match newlines. Toggle them here and the highlighting updates instantly, which is the fastest way to understand each one.
Yes, it all runs locally so size is limited only by your machine. One honest caveat: certain nested-quantifier patterns can trigger catastrophic backtracking in any regex engine, and since this evaluates in your tab, a pathological pattern freezes your page, not my server.
No. Pattern, flags, text and replacements are all evaluated in your browser and never transmitted. Paste fragments of production data with a clear conscience, though redacting secrets first is still a good habit anywhere.

