Regex Tester
Build a JavaScript regular expression and see matches, capture groups, and a live replace preview as you type. Toggle the g i m s u y flags, and invalid patterns show a friendly error instead of breaking.
10241024222288176176Regex testing, explained
What do the flags g, i, m, s, u, and y mean?+
g finds all matches instead of just the first, i ignores case, m makes ^ and $ match at line breaks, s lets the dot match newlines, u enables full unicode mode, and y (sticky) only matches starting exactly at the last index.
Why does my pattern show an error?+
The tool builds your pattern with new RegExp inside a try/catch. If the syntax is invalid, for example an unclosed group like "(", it shows the browser error message instead of crashing. Fix the pattern and the results update instantly.
What are capture groups?+
Parentheses in a pattern capture part of each match. The tool lists every group per match, numbered from 1, plus any named groups written as (?<name>...). Groups that did not participate in the match are shown as no match.
How does the Replace field work?+
It runs testString.replace(regex, replacement) live. You can use standard replacement tokens: $1, $2 for capture groups, $& for the whole match, $<name> for named groups, and $$ for a literal dollar sign.
Does my text leave my browser?+
No. This regex tester is completely free with no login, and your pattern and test string are evaluated entirely in your browser. Nothing is uploaded to a server.
Related tools
All tools →More in General Tools.

