Regex tester
Type a pattern and some text to see every match, its capture groups and a replace preview.
//
Matches
JavaScript
Common patterns
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.