Regex Tester
Live regex testing with match highlighting, capture group display, and substitution preview. ECMAScript flavour; runs in your browser.
Matches 2
Substitute
About this tool
Paste a pattern, a test string, and watch matches light up. Each
match is listed below the highlighted text with its index, the full
match, and every capture group (positional and named). Toggle flags
to see how the behaviour changes — g for global,
i for case-insensitive, m for multiline,
s for dotAll, u for Unicode, y
for sticky.
The substitution section lets you preview the result of
str.replace(pattern, replacement) in real time. Use
$1/$2 for numbered captures and
$<name> for named captures.
The regex engine is the browser’s native ECMAScript implementation. If you need to verify a pattern for a Python, Go, Java, or PCRE runtime, prefer a flavour-specific tool — small differences in escaping rules and feature support routinely trip people up.
Frequently asked questions
Which regex flavour does this use?
ECMAScript regex — the one built into JavaScript. Lookbehind, named captures, Unicode property escapes, and the dotAll flag are all supported in modern browsers. Some flavours common in other languages (Perl-compatible backtracking, POSIX, .NET extensions) behave differently.
What do the flags mean?
g = match all occurrences, i = case-insensitive, m = multiline (^ and $ match line boundaries), s = dotAll (. matches newlines), u = full Unicode, y = sticky (match from lastIndex only). Hover any flag for a tooltip.
Why do I get no matches when I know the pattern is right?
Common causes: the `g` flag is off and only the first match is shown; the pattern uses lookbehind or named captures that need the `u` flag; escapes were copied from a language with different rules. Paste a minimal test case and check the Match list for detailed errors.
What is the replacement string syntax?
Use $1, $2 (etc.) to insert numbered capture groups, $<name> for named groups, $& for the whole match. A literal dollar sign is written as $$.
Is my test string sent to your servers?
No. All matching happens in the browser using the built-in RegExp engine.