JavaScript Regex Tester & Highlighter

Test regular expressions with flags (g, i, m, u), live match highlights, capture groups, and common developer presets.

How It Works & Reference

Enter your regex pattern (without outer slashes) and flags such as g (global) and i (case-insensitive). Click any preset button to load battle-tested patterns for emails, URLs, IPv4, or SemVer.

Common JavaScript Regex Tokens

TokenMatchesExample
\d / \w / \sDigit / Word / Whitespace\d{4} matches 2026
+ / * / ?1+ / 0+ / 0 or 1v?\d+ matches v2 or 2
^ / $Start / End of string (or line with m)^https://
(?:...)Non-capturing group(?:http|https)://

Frequently Asked Questions

Which regex flavor does this tester use?

It uses your browser's native ECMAScript (JavaScript) RegExp engine, supporting lookbehinds and Unicode property escapes.

Why does my pattern only match the first result?

Add the 'g' (global) flag in the flags box to find all matches across the input text.

Can I inspect capture groups?

Yes, every match lists its full match and numbered capture groups ($1, $2, ...).

Related Tools