Regex Tester

Enter a pattern and flags, then paste text to test against it — matches highlight live, and every capture group is broken out below.

How Regex Tester Works

A regular expression that looks right on paper often behaves differently against real text -- an unescaped character, a greedy quantifier, or a missing flag can silently change what matches. This tool runs your exact pattern against your test text live, highlighting every match in place and breaking out each capture group into its own row, so mismatches are visible immediately instead of discovered later in production.

Formula & Method

Your pattern and flags are compiled into a real JavaScript RegExp object -- the exact same regex engine that runs in the browser and in Node.js -- so what matches here is what would match in actual JavaScript code, not an approximation. With the Global flag on, every non-overlapping match in the text is found via repeated calls to regex.exec(); without it, only the first match is shown. Each match's full text and every numbered or named capture group are extracted and displayed in a table, and the highlighted view re-renders the original text with each match wrapped in a marker so overlapping context is easy to see.

Worked Example

The default pattern (\w+)@(\w+\.\w+) against "Contact us at support@clickulate.com or sales@example.org for help." finds two matches, each with two capture groups: Group 1 is the part before the @ (support, sales) and Group 2 is the domain (clickulate.com, example.org) -- a simplified email-address pattern showing how parentheses split a match into addressable pieces.

Frequently Asked Questions

What's the difference between the flags — do I need all of them?
Each flag changes matching behavior independently: Global (g) finds every match instead of stopping at the first; Case Insensitive (i) ignores letter case; Multiline (m) makes ^ and $ match at line breaks instead of only the string's start/end; Dot Matches Newline (s) lets . match newline characters, which it normally doesn't; and Unicode (u) enables correct handling of characters outside the basic ASCII/BMP range. Most everyday patterns only need Global, sometimes with Case Insensitive.
Why does my pattern throw an error instead of just matching nothing?
A regex can be syntactically invalid -- unbalanced parentheses, an unescaped special character used incorrectly, or an unsupported combination of flags -- and JavaScript throws a real exception when it tries to compile an invalid pattern, rather than silently treating it as "no matches." This tool surfaces that exact error message so you know it's a syntax problem, not a data problem.
Why are there separate columns for numbered groups and named groups?
Regex supports two ways to capture a sub-match: positional groups, referenced by number ((1), (2), ...), and named groups written as (?<name>...), referenced by that name. A pattern can use either or both, so this tool shows whichever your specific pattern actually defines -- if you haven't used named groups, that section of the table simply won't appear.
Is there a limit on how much text I can test against?
Yes -- test strings over 20,000 characters aren't evaluated live, and matching stops after 1,000 matches even on shorter text. This protects against certain pathological patterns (sometimes called "catastrophic backtracking") that can make a regex engine hang on a large enough input, which would otherwise freeze the page.
Matches Found