Regex Tester

Test JavaScript regular expressions against text for free, with live highlighting.

This tool runs entirely in your browser. Your files are never uploaded to a server.

2 matches

What this tool does

Write a regular expression, choose flags, and see every match highlighted directly inside your test string, updating live as you type.

How to use it

Edit the pattern field, toggle the flag checkboxes you need, and type or paste your test string — matches are highlighted below immediately, with no run button to press.

Worked example

With the default pattern `\b\w+@\w+\.\w+\b`, flags `g` and `i` enabled, and the test string "Contact us at [email protected] or [email protected]", both email-shaped substrings are highlighted and the tool reports 2 matches.

Supported flags

Four flags are available as checkboxes: `g` (global — find all matches, not just the first), `i` (case-insensitive), `m` (multiline, so `^`/`$` match line boundaries), and `s` (dotAll, so `.` also matches newlines). Combine any of them freely.

How matches are highlighted

Without the `g` flag, only the first match in the string is found and highlighted, mirroring how JavaScript's own `.match()` behaves without the global flag — enable `g` if you expect more than one match.

Limitations

This uses JavaScript's native `RegExp` engine only — patterns relying on PCRE-only features like recursive patterns, possessive quantifiers, or atomic groups from other regex flavors may behave differently or fail to parse. An invalid pattern shows the engine's own error message instead of a match count.

Privacy

Everything — the pattern, flags, and test string — is processed locally in your browser; nothing is sent to a server.

Frequently Asked Questions

Which regex flavor does it use?
JavaScript's native RegExp engine, the same one used in browsers and Node.js — not PCRE, Python's re module, or other regex flavors, which can differ on advanced features.
Why does my pattern only match once even though it appears twice?
The global flag (g) needs to be enabled to find every occurrence; without it, only the first match in the string is located and highlighted.
What happens if I write an invalid pattern?
The tool shows the exact error message JavaScript's RegExp constructor throws, instead of a match count, so you can see what's wrong with the syntax.
Is my test text sent anywhere?
No, the pattern, flags, and test string are all processed entirely locally in your browser.