Regex tester

Write a pattern, paste your text, and see every match highlighted as you type — with capture groups, named groups and match positions listed below.

How to use

  • Enter the pattern without the surrounding /…/ slashes — those are JavaScript literal syntax, not part of the pattern itself.
  • Tick flags as needed: g finds all matches, i ignores case, m makes ^ and $ match line starts and ends, s lets . cross newlines, u enables full Unicode.
  • Everything re-runs as you type, so iterate quickly.

Capture groups in the table

Numbered groups show as 1: value, named groups as name: value. Unmatched optional groups display as an em dash. The table lists at most the first 100 matches — enough to sanity-check a pattern, without freezing the page on pathological input.

Pitfalls this tool helps catch

  • Catastrophic backtracking: nested quantifiers like (a+)+$ can hang an engine. If typing feels laggy, your pattern may be one of those — simplify it.
  • Missing g flag: without it, String.replace only touches the first match — a classic bug the highlight makes obvious at a glance.
  • Escaping in strings vs. regex: in a regex literal \d is fine, but inside a string literal you need \\d. Test patterns here exactly as they will run.

FAQ

Which regex flavor is this?

JavaScript's own RegExp engine (ECMA-262). It is close to PCRE for everyday patterns but lacks lookbehind variances in very old browsers, recursion and subroutine calls. If your production stack is Python, Go or PCRE, edge cases can differ.

Why do zero-length matches not appear?

They do — a pattern like a* matches empty strings between characters. The table shows them with their index; visually there is simply nothing to highlight.

Is my text sent anywhere?

No. Matching runs in your browser on every keystroke; nothing is uploaded.

Other tools