Regex Tester & Debugger
Test a regular expression against your text with live highlighting, capture groups and a replace preview — nothing leaves your browser.
🔒 Runs entirely in your browser — nothing you type is uploaded or stored on a server.
The Regex Tester lets you build and debug a regular expression and see exactly what it matches, live. Type a pattern, toggle the flags you need, and paste your test text — every match is highlighted in place and listed below with its capture groups, numbered and named. It's the fastest way to get a tricky pattern right before dropping it into your code.
It uses the browser's own JavaScript regex engine, so what you see here behaves exactly like it will in your JS, TypeScript or Node code — including named groups, Unicode mode and the dotall flag. Invalid patterns show a clear error instead of failing silently, and matching is guarded so a pattern that could otherwise loop forever on a zero-width match stops cleanly.
There's a built-in replace preview too: type a replacement (with $1, $<name> or $& back-references) and watch the substituted result update as you type, ready to copy. Everything runs in your browser, so proprietary code, logs and data you're testing against never leave your device. Companion tools: Find & Replace for simple substitutions and the Email & URL Extractor for common patterns without writing regex.
How to use
- Type your regular expression into the pattern field (no slashes needed).
- Toggle the flags you want: global, ignore case, multiline, dotall or unicode.
- Paste the text to test against — matches highlight instantly and are listed with their groups.
- Read the match count and inspect each capture group, numbered ($1, $2…) and named.
- Optionally type a replacement to preview a find-and-replace, then copy the result.
Examples
The pattern “[0-9]+” with the global flag highlights every run of digits in your text and lists each one.
“(\w+)@(\w+)” splits an address into its two halves — group $1 is the name, $2 the domain — shown for every match.
“(?<year>\d{4})-(?<month>\d{2})” labels each part by name, so the year and month are listed clearly.
Match “\s+” globally and replace with a single space to collapse whitespace, previewed live before you copy.