Regex tester
Test a regular expression against your text and see every match highlighted.
See what actually matches
Type a pattern and your text, and every match is highlighted as you type. Capture groups are listed underneath with their positions, so you can see not just whether the pattern matched but exactly what each group caught.
The flags, and which ones you need
- g — find every match rather than stopping at the first. Almost always wanted here.
- m — makes
^and$match at each line rather than only at the start and end of the whole text. - i — ignore case.
- s — lets
.match newlines, which it otherwise never does. This one surprises people constantly. - u — proper Unicode handling, needed for
\p{...}classes and for emoji to count as one character.
The most common mistakes
Greedy quantifiers. <.*> against <a>text</a> matches the whole string, not the first tag, because * takes as much as it can. Add ? to make it lazy: <.*?>.
Unescaped dots. . means any character. To match a literal full stop, escape it.
Catastrophic backtracking. Nested quantifiers like (a+)+$ can take exponential time on input that nearly matches. This runs in your browser, so a runaway pattern costs you a slow tab rather than taking down a server — but it is worth understanding before deploying one.
This is JavaScript's flavour
Regex dialects differ. Lookbehind, named groups and Unicode property escapes all work here, but PCRE features such as recursion and atomic groups do not exist in JavaScript. If your pattern is destined for Python or PHP, verify it there too.
Nothing is uploaded
Pattern and text both stay in your browser — which matters, since test data is usually real data.
Common questions
Why does my pattern match too much?
Quantifiers are greedy by default. Add ? to make them lazy — .*? instead of .*
Why does . not match my newline?
It never does unless you add the s flag.
Which regex dialect is this?
JavaScript's. Lookbehind and named groups work; PCRE recursion and atomic groups do not exist here.
Can a pattern hang the page?
Nested quantifiers can backtrack catastrophically. It runs locally, so the cost is a slow tab rather than a downed server.
Is my test data uploaded?
No. Everything runs in your browser.