Regex Tester

Write a pattern and see what it matches as you type, with every match highlighted and its capture groups listed. Flags are toggles rather than something to remember the letters for, and an invalid pattern gets the engine's own error rather than silently matching nothing.

Frequently asked questions

Which flavour of regular expression is this?

JavaScript's, which is what runs in your browser. It is close to PCRE but not identical — lookbehind is supported in current browsers, and there are no possessive quantifiers or atomic groups. Patterns written for Python or PHP mostly transfer, but not always.

What does the global flag change?

Without it you get the first match only. With it, all of them. It also makes the regex object stateful through lastIndex, which is a classic source of bugs when the same object is reused across calls — this tool creates a fresh one each time.

Why does my pattern hang the browser?

Catastrophic backtracking. Nested quantifiers over overlapping alternatives, such as (a+)+b against a long run of a characters, make the engine explore exponentially many paths. Rewrite to avoid nesting quantifiers, or anchor the pattern so it fails fast.

Related tools