Skip to content

Regex Tester

Pattern + text → matches + capture groups, in your browser. JavaScript flavour.

Test JavaScript regular expressions against any string and see every match — total count, index, and named/numbered capture groups — instantly. All six flags (g, i, m, s, u, y) are toggleable and the parse error (when there is one) shows up in plain English instead of stopping the page.

//g
6 matches
  • The@0
  • Brown@10
  • Lazy@35
  • Dog@40
  • It@45
  • Istanbul@66

JavaScript regex (ECMAScript flavour). Backreferences, lookahead / lookbehind, and named groups all supported. For PCRE-only features (recursive patterns, conditional groups) use a dedicated PCRE tool.

How to use

  1. Paste your pattern

    Without the surrounding slashes — just the pattern body. Backslashes escape as usual (\d for digit, \w for word char, etc.).

  2. Toggle the flags you need

    g for all matches (not just the first), i for case-insensitive, m for multiline ^/$, s for dotall, u for full Unicode, y for sticky.

  3. Read the match list

    Each match shows its text, its position in the input (@N), and any capture groups it produced. Errors render in red instead of crashing.

Common patterns

GoalPattern
Email-ish\b[\w.+-]+@[\w-]+\.[\w.-]+\b
URLhttps?:\/\/[\w.\-/?=&%]+
Hex color#([\da-f]{3}){1,2}\b
Phone (US)\(?\d{3}\)?[\s-]\d{3}-\d{4}
ISO date\d{4}-\d{2}-\d{2}
Capitalized word\b[A-Z]\w+

Frequently asked questions

Which regex flavour is this?
ECMAScript — the regex flavour JavaScript itself uses. Lookahead / lookbehind, named groups, Unicode escapes are all supported. PCRE-only features (recursive subpatterns, conditional groups, possessive quantifiers) are not.
Why does my pattern hang?
Catastrophic backtracking — a regex that explores exponential paths on certain inputs. Our tester caps at 50,000 matches before bailing out, but a pattern can still take seconds before hitting the cap. Refine ambiguous quantifiers (replace .* with [^x]* where you mean it).
Can I test against multiline input?
Yes. Enable the m flag if you want ^ and $ to match line boundaries; enable s if you want . to match newline characters.
Does the tool store my pattern or text?
No. Everything runs in your browser. There's no upload, no log, no analytics on payload content.

About

Why ECMAScript specifically

It's the regex you'll actually deploy. Node.js, every browser, and Deno all share the same engine. If your pattern works here, it works in production JavaScript. PCRE is more powerful but you can't use it in a client-side validator.

Capture groups vs lookarounds

Capture groups (parentheses) are part of the match and are returned. Lookarounds (?=…), (?!…), (?<=…), (?<!…) are conditions on the surrounding text but aren't part of the match — useful when you want 'words that follow a comma' without including the comma in the result.