🔍

Regex Tester

Test regular expressions with live match highlighting.

🔒 Runs entirely in your browser — nothing is uploaded. JavaScript regex flavor.

/ /

How Regex Tester works

How does the regex tester work?

It builds a native JavaScript RegExp from the pattern and flags you enter and runs testText.matchAll() against it, so behavior matches exactly what you would get running the same regex in a browser console. Matches are wrapped in <mark> tags after the test text is HTML-escaped, so the highlighting cannot be broken by special characters in your text.

What is it useful for?

It is a fast way to iterate on a regular expression - checking an email validation pattern, extracting a substring, or debugging why a pattern is not matching - before dropping it into real code.

Why does the match count change even if I did not type a "g" flag?

Because matchAll() requires a global regex, the tool silently appends g internally when building the pattern for matching, even if your flags field only has i or is empty. The flags input itself is not rewritten, but highlighting and match count always reflect every match, not just the first.