Developer Tools

Regex Tester

Build and test regular expressions live — see matches highlighted, capture groups listed, and replace results previewed instantly in your browser.

//g
Match preview
Test string will appear here…
Overview

Regex Tester: build and debug regular expressions in real time

This regex tester lets you write a regular expression, pick your flags, paste a test string, and see every match highlighted inline — all in real time as you type. It uses the JavaScript RegExp engine directly in your browser, so what you see here is exactly what you get in a JS codebase. If your pattern contains a syntax error the tool shows a clear error message instead of silently failing.

Beyond simple match counting, the tester shows a table of numbered and named capture groups for every match, so you can verify that parentheses are capturing the right substrings. The replace panel lets you preview .replace() results with back-references ($1, $&, etc.) before you commit them to your code. Everything runs locally — no text is sent to a server.

100% freeNo sign-upRuns in your browserLive match highlighting

How to use it

  1. 1Type your regular expression pattern in the pattern field. The surrounding slashes and flags are shown automatically.
  2. 2Toggle the flag buttons (g, i, m, s, u, y) to match your intended use case.
  3. 3Paste or type your test string. Matches are highlighted in amber immediately.
  4. 4Optionally enter a replacement string to preview the .replace() output.
  5. 5Inspect the capture groups table to verify each group is capturing correctly.

Key features

Live match highlighting inside the test string
Clear error messages for invalid regex patterns
All six JavaScript flags (g, i, m, s, u, y) individually toggleable
Numbered and named capture group table for every match
Real-time .replace() preview with back-reference support
Match count badge — see at a glance how many matches were found
100% client-side — your patterns and text never leave your browser

Frequently asked questions

What regex flavour does this tester use?
It uses the JavaScript (ECMAScript) RegExp engine built into your browser. This is the same engine used by Node.js, so results match JS code exactly. It is different from PCRE or Python regex in a few edge cases.
Why are some flags greyed out or not matching?
The 'y' (sticky) flag matches only at lastIndex and is incompatible with 'g' in terms of global iteration — with 'y' enabled only the first match from position 0 is shown. The 's' flag (dotAll) requires a modern browser. If a flag combination is invalid the error panel will explain it.
How do I reference capture groups in the Replace field?
Use $1, $2, … for numbered groups and $<name> for named groups. $& inserts the full match, $` inserts the text before the match, and $' inserts the text after. These are standard JavaScript .replace() back-references.
Is there a limit to how much text I can test?
There is no hard limit, but the tool caps processing at 1 000 matches to keep the browser responsive on very large inputs. For extremely large files consider splitting the text.