JavaScript Regular Expression Tester
JavaScript regular expression tester — shows all matches and capture groups in real time, with g / i / m / s / u / y flag toggles.
Usage
Tests JavaScript regular expressions (the ECMAScript regex engine). Supports the six flags g i m s u y, highlighting all matches in real time and listing capture groups.
JS regex differs from PCRE / Python in some details (lookbehind, named groups, etc.).
Use cases
FAQ
Which regex flavor is this?
JavaScript / ECMAScript. Differs from PCRE and Python in lookbehind, named groups and a few other details.
Are lookbehinds supported?
(?<=...) and (?<!...) work in all modern browsers; older Safari (<16.4) doesn't.
How do I write a named group?
(?<name>...). Access the value via match.groups.name. The tool shows named groups automatically.
Why does g flag affect test() between calls?
g-flag regexes have a lastIndex state; consecutive test() calls continue from the previous position. Reset lastIndex or reuse a fresh regex between calls.