JavaScript Regex Tester

Regular expressions are dense enough that trial and error is the only realistic way to build one. This tester evaluates your pattern against sample text on every keystroke, highlights each match in place, and lists capture groups and their positions so you can see exactly what the engine matched.

How to use it

  1. Type your pattern without the surrounding slashes.
  2. Set flags: g for all matches, i for case-insensitive, m for multiline.
  3. Paste sample text underneath.
  4. Review the highlighted matches and the capture groups for each one.

Frequently asked questions

Which regex flavour does this use?

JavaScript’s, via the native RegExp engine. Most syntax is shared with PCRE, but lookbehind support varies by browser and some PCRE features such as recursion do not exist here.

What is catastrophic backtracking?

A pattern with nested quantifiers like (a+)+ can take exponential time on non-matching input, freezing the page or hanging a server. Avoid nesting quantifiers around the same character class.

How do I match a literal dot?

Escape it as \. — an unescaped dot matches any character except a newline, which is why unanchored patterns often match far more than intended.

Should I parse HTML with a regex?

No. HTML is not a regular language, so nesting will eventually defeat any pattern. Use a DOM parser; regex is for flat, predictable text.

All free tools · Blog · About · Contact

Also available in: Español · Português · Français · Deutsch