Regex Tester
Test a regular expression against sample text, with live match highlighting and capture groups.
How to Test a Regular Expression
- Type your regex pattern into the pattern field (without the surrounding slashes).
- Choose which flags to apply — global (g) is on by default so every match gets highlighted, not just the first.
- Paste or type your test string in the box below.
- Matches highlight live as you type, with any capture groups listed underneath.
Frequently Asked Questions
Which regex flavor does this tester use?
It uses your browser's native JavaScript regex engine (the RegExp object), so it behaves exactly like the regex you'd write in a real JavaScript project — not PCRE, Python's re, or another language's flavor, which can have subtly different syntax.
Why do I need the "g" flag to see all matches highlighted?
Without the global flag, JavaScript's regex engine stops after the first match. The g flag tells it to keep scanning the rest of the string and report every match, which is why it's checked by default here.
What do the numbered groups in the results mean?
Each pair of unescaped parentheses in your pattern creates a capture group. For every match, the tool lists what each group actually captured in that match, numbered in the order the groups appear in your pattern — useful for pulling out specific pieces of a match rather than the whole thing.
Why does my pattern show an error instead of running?
The pattern you typed isn't valid JavaScript regex syntax — commonly an unescaped special character, an unclosed bracket or group, or an invalid flag combination. The error message shown is JavaScript's own SyntaxError text, which usually points at what's wrong.
Is my text or pattern sent anywhere?
No — matching runs entirely in your browser using JavaScript's built-in regex engine. Nothing you type is transmitted anywhere.