Regex Tester & Debugger

Test a regular expression against your text with live highlighting, capture groups and a replace preview — nothing leaves your browser.

/ / g
Enter a pattern to begin.

🔒 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

  1. Type your regular expression into the pattern field (no slashes needed).
  2. Toggle the flags you want: global, ignore case, multiline, dotall or unicode.
  3. Paste the text to test against — matches highlight instantly and are listed with their groups.
  4. Read the match count and inspect each capture group, numbered ($1, $2…) and named.
  5. Optionally type a replacement to preview a find-and-replace, then copy the result.

Examples

Find all numbers
The pattern “[0-9]+” with the global flag highlights every run of digits in your text and lists each one.
Capture groups
“(\w+)@(\w+)” splits an address into its two halves — group $1 is the name, $2 the domain — shown for every match.
Named groups
“(?<year>\d{4})-(?<month>\d{2})” labels each part by name, so the year and month are listed clearly.
Replace preview
Match “\s+” globally and replace with a single space to collapse whitespace, previewed live before you copy.

Frequently asked questions

Which regex flavour does this use?
The JavaScript (ECMAScript) engine built into your browser. Patterns behave exactly as they will in JS, TypeScript and Node, including named capture groups, the u (unicode) and s (dotall) flags. Syntax from other languages (like Python's look-behind quirks or PCRE-only features) may differ.
What do the flags mean?
global (g) finds all matches not just the first; ignore case (i) is case-insensitive; multiline (m) makes ^ and $ match at line breaks; dotall (s) lets . match newlines; unicode (u) enables full Unicode and \p{} escapes.
Does it show capture groups?
Yes. Each match lists its numbered groups ($1, $2, …) and any named groups, so you can confirm your pattern captures exactly the parts you expect.
Can I test a find-and-replace?
Yes. Enter a replacement string using $1, $<name> or $& back-references and the replaced text is previewed live. If the global flag is off, only the first match is replaced — just like String.replace in JavaScript.
What happens with an invalid pattern?
You get a clear error message describing the problem, and the highlighting pauses until the pattern is valid again — so a half-typed regex never throws or breaks the page.
Is my text or pattern uploaded?
No. Everything runs in your browser using its native regex engine, so the patterns you write and the text you test — including private code and logs — never leave your device.