Regex Tester

Test JavaScript regular expressions against real text. See every match highlighted, inspect capture groups, and preview a replacement — all in your browser.

About regular expressions

Which regex flavour is this?

JavaScript (RegExp, ES2018 and later), because the test runs in your browser with the same engine your code will use. Lookbehind, named groups and Unicode property escapes all work. Patterns written for PCRE, Python or .NET sometimes differ — most commonly around lookbehind and \d matching only ASCII digits here unless you enable the unicode flag.

What do the flags mean?

g finds every match instead of stopping at the first. i ignores case. m makes ^ and $ match at line breaks. s lets . match newlines. u turns on full Unicode handling, which is required for property escapes such as \p{L} and for correct behaviour with emoji.

Why does it stop at 10,000 matches?

To keep the page usable. A pattern like .* over a large file can produce an enormous number of matches, and rendering them all would freeze the tab. When the cap is reached you are told, and the highlighting shows the first portion.

My pattern seems to hang. What happened?

Almost certainly catastrophic backtracking — nested quantifiers such as (a+)+$ against a long non-matching string take exponential time. The browser tab has to be force-closed in that case; there is no way to interrupt a running regular expression from JavaScript. Flatten nested quantifiers or use a possessive-style rewrite before testing again.

How do the replacement references work?

$1, $2 and so on insert numbered capture groups, $<name> inserts a named group, $& inserts the whole match, and $$ is a literal dollar sign. The replacement preview uses exactly the same semantics as String.replace() in JavaScript.

Is my text uploaded anywhere?

No. The pattern and the test string are both handled by JavaScript in your browser. There is no server involved and nothing leaves your device.