regex tester
Write a pattern, paste some text, and see the matches and capture groups as you type. Everything runs locally.
Runs in your browser — nothing is uploadedCatastrophic backtracking
Nested quantifiers such as (a+)+$ can take exponential time on input that nearly
matches, which turns a regex on user input into a denial-of-service vector. If a pattern is slow on a
30-character string, it is not slow, it is exponential. Avoid nesting quantifiers, and prefer explicit bounds
over .*.
Flavours differ
JavaScript, PCRE, Python, Go and Java disagree on lookbehind, named groups, atomic groups and possessive quantifiers. A pattern proven in one engine is not proven in another. This tester uses the JavaScript engine, which is what runs in the browser.
Unicode
Without the u flag, . matches a single UTF-16 code unit, so it splits
an emoji in half. With it, \p{L} and friends become available and character classes behave as
you would expect for non-Latin text.
Questions
Why is my regex so slow?
Probably catastrophic backtracking from nested quantifiers. On input that almost matches, the engine explores exponentially many paths. Rewrite to avoid nesting, or bound the repetition.
Which regex flavour does this use?
The browser's JavaScript engine. Lookbehind, named groups and Unicode property escapes are supported in current browsers, but other languages differ.
Why does my pattern break on emoji?
Without the u flag a dot matches one UTF-16 code unit, and an emoji is usually two. Add the u flag.
Is my text sent anywhere?
No. The matching runs in your browser.