Regex Tester
Test regular expressions against sample text in your browser. Live match highlighting, capture groups, and flags (g, i, m, s, u, y). Nothing you type is ever sent anywhere.
How it works
This tool runs your pattern through JavaScript's native RegExp engine — the same one used by every modern browser and Node.js — directly in your browser. As you type a pattern and test string, matches are found and highlighted immediately, with no page reload and no data sent to a server. Each match's captured groups (the parts of your pattern inside parentheses) are listed below the result so you can confirm your groups line up the way you expect before pasting the pattern into real code.
By default the tool searches for every match in your test string (the "g" flag). Untick it to see how your pattern behaves without the global flag — useful when you're about to use it with methods like String.prototype.match() that treat non-global patterns differently. If your pattern is invalid, you'll see the exact error the browser's regex engine reports, which is usually the same error you'd get at runtime in your own code.
Limitations
This tool tests JavaScript regex specifically. Other languages use different regex flavors: Python's re module, PCRE (used by PHP and many command-line tools), and .NET's regex engine all support slightly different syntax — named capture groups, lookbehind assertions, and possessive quantifiers in particular vary between flavors. A pattern that works here should work in your JavaScript/TypeScript code, but isn't guaranteed to behave identically if you paste it into a Python or PHP project.
FAQ
Does this use the same regex engine as my code?
Yes, if you're writing JavaScript or TypeScript: this tool runs your pattern through the browser's native RegExp engine, the exact same one Node.js and every browser use. If you're testing a pattern meant for Python, PHP, or another language, results may differ slightly (lookbehind support, named groups syntax, and a few escape sequences vary between regex flavors).
Why does my pattern only match once?
By default, JavaScript regex stops after the first match. Check the "g" (global) flag above to find every match instead of just the first one.
What do the flags mean?
g (global) finds all matches instead of stopping at the first. i (case insensitive) ignores letter case. m (multiline) makes ^ and $ match the start/end of each line instead of the whole string. s (dotall) makes . also match newlines. u (unicode) enables full Unicode pattern handling. y (sticky) matches only starting at the current position.
Is my text uploaded anywhere?
No. Everything runs locally in your browser with JavaScript's built-in RegExp — your pattern and test text never leave your device.