JavaScript regex tester and checker
Type a pattern and some text to see every match, its capture groups and a replace preview.
//
Matches
JavaScript
Common patterns
Runs entirely in your browser. Nothing you type or upload is sent to a server.
How to use JavaScript regex tester
- Type your regular expression, or pick a ready-made pattern.
- Set the flags, such as global or ignore case.
- Paste your test text to see every match and its capture groups.
- Optionally type a replacement to preview the result.
Common questions
Which regex flavour does this use?
JavaScript (ECMAScript), the same engine as Node.js and browsers. Most syntax is shared with Python, Go and PCRE, but lookbehind support, possessive quantifiers and flags can differ.
Why does my pattern match only once?
Without the g (global) flag, JavaScript stops at the first match. The replace preview also replaces only the first match.
What do the m and s flags change?
m makes ^ and $ match at the start and end of every line. s lets . match newlines too.
Why did my browser tab freeze?
Patterns with nested repeats like (a+)+ can take exponential time on some inputs (catastrophic backtracking). Make the inner part more specific.
Was this page useful?