Regex editor with match highlighting & capture groups
A regex tester lets you build, debug, and verify regular expressions interactively — paste your test text, type your pattern, and watch matches highlight in real time without flipping through documentation.
This tool uses the JavaScript regex flavor (the same one your browser and Node.js run). It supports all standard flags (g, i, m, s, u, y), highlights every match, and breaks out each capture group so you can confirm the structure of complex patterns.
Pattern: ([a-z0-9._%+-]+)@([a-z0-9.-]+\.[a-z]{2,})
Flags: gi
Text: Contact [email protected] or [email protected]Match 1: [email protected]
Group 1: alice
Group 2: toolcozy.com
Match 2: [email protected]
Group 1: bob
Group 2: example.orgPattern: \d+
Flags: g
Text: Order 12 of 350 shipped on day 7Matches: 12, 350, 7JavaScript / ECMAScript. That means lookbehind ((?<=…)) is supported in modern browsers, named groups ((?<name>…)) work, but PCRE-specific features like recursion and possessive quantifiers do not.
g = find all matches (not just the first). i = case-insensitive. m = ^ and $ match per line. s = . also matches newlines. u = full Unicode (including surrogate pairs and \p{} property classes). y = sticky (matches only at lastIndex).
Common causes: forgetting the g flag (only first match shown), using \ in HTML-escaped form (need a single backslash in the pattern field), confusing greedy and lazy quantifiers, or the test text actually doesn't contain what you think (extra spaces, smart quotes, etc.).
It can. Patterns with nested quantifiers like (a+)+ on a long input cause catastrophic backtracking — the regex engine tries exponentially many combinations. If your test text is small you'll be fine here, but never run such patterns on user input in production.
Yes — (?<year>\d{4}) creates a named group. The matched value also shows up by index, so older code that uses match[1] still works.