Z

Regex Tester

Test regular expressions against sample text with live match highlighting and flags.

Runs in your browser — files never leave your device

2 matches
  • ada@example.com
  • bob@test.org

How it works

Type a pattern, optional flags, and some test text, and the tool shows every match instantly — both the total count and the matched strings themselves. It’s a live sandbox for building an expression before you commit it to code, or for dissecting one you’ve inherited.

The flavor is JavaScript’s own RegExp — your pattern is compiled and executed by the browser’s regex engine, so what matches here matches identically in frontend code and Node.js. The global flag is added automatically when you omit it, so you always see every match rather than just the first. Zero-length matches are listed as (empty), and an invalid pattern or flag combination shows the engine’s error message instead of results.

The preloaded example demonstrates the idea: the pattern \b\w+@\w+\.\w+\b — word boundary, word characters, an @, more word characters, a literal dot, a final run — finds exactly two matches in Contact: ada@example.com or bob@test.org, namely ada@example.com and bob@test.org.

Flags change how the pattern applies: i ignores case (with it, cat finds all three of Cat, cat, and CAT), m makes ^ and $ anchor at every line break, s lets the dot cross newlines, u enables full Unicode handling, and y requires each match to start exactly where the previous one ended.

Two things to keep in mind. Type the pattern raw: no surrounding slashes, no quotes, and single backslashes — \d, not \\d; the doubled form belongs only inside JavaScript string literals. And while JavaScript supports lookahead, lookbehind, and named groups, patterns written for PCRE or Python may use features it lacks — possessive quantifiers, atomic groups — which will surface here as an error. Better to find out in the tester than in production.

Frequently asked questions

Which regex flavor does this use?
JavaScript (ECMAScript) regular expressions, executed by your browser’s own RegExp engine — so a pattern that works here behaves identically in frontend code and Node.js. Most PCRE syntax carries over, but PCRE-only features such as possessive quantifiers and atomic groups are not supported.
What do the flags mean?
g finds all matches instead of stopping at the first (this tool adds it automatically), i ignores case, m makes ^ and $ match at every line break, s lets the dot match newlines, u enables full Unicode handling, and y anchors each match to start exactly where the previous one ended. Combine them freely, e.g. im.
How should I type the pattern?
Enter it raw — no surrounding slashes and no quotes. Backslashes are literal, so type \d, \b, or \. directly; if you are copying from a JavaScript string literal such as "\\d+", collapse the doubled backslashes to single ones first.
Why do I see (empty) in the match list?
Your pattern can match a zero-length string — x* or (abc)? succeed “zero times” at every position, producing empty matches between characters. Switch * to + or anchor the pattern so it must consume at least one character.
Can I see capture groups?
Groups work for matching — alternation, backreferences, and quantified groups all behave normally — but the results list shows each overall match only, not the captures inside it. To inspect group values, run the same pattern in code with matchAll and read entries 1 and up of each match.
Are lookahead and lookbehind supported?
Yes. Lookahead (?=…) has always been part of JavaScript, and lookbehind (?<=…) is supported by all current browsers — Safari added it in 16.4 — so patterns from modern JS code run unchanged. If a pattern errors on an older device, lookbehind is the usual culprit.
Is my text uploaded?
No. The pattern and test text are evaluated entirely in your browser and never leave your device — nothing is logged or sent to a server.