Regex Tester

Test regular expressions with live matching.

0 matches found

How the Tester Works

Type a pattern, set your flags, paste a test string — every match appears instantly below, with its character position and the exact text it captured. The tester uses your browser's native JavaScript RegExp engine, so what matches here matches in Node.js and every modern browser, byte for byte. Everything runs locally; nothing is sent to a server.

Example: pattern \d+ with flag g against "Order 42 shipped in 3 days" returns two matches — [6] "42" and [18] "3". The number in brackets is the index where the match starts.

Regex Syntax Cheat Sheet

TokenMatchesExample
\d / \w / \sdigit / word char / whitespace\d{4} → "2026"
[a-z]character range[aeiou] → any vowel
+ / * / ?1+, 0+, 0 or 1 repetitionscolou?r → "color", "colour"
^ / $start / end of line (with m)^ERROR → lines starting with ERROR
(…)capture group(\w+)@(\w+)
a|balternationcat|dog
\.literal dot (escaped)3\.14

Flags: Keep the g

The flags field accepts any combination of g (global — find all matches, not just the first), i (case-insensitive), m (multiline — ^/$ match per line), s (dot matches newlines) and u (Unicode). The tester lists all matches, which requires the g flag — if you remove it, you'll see zero results even for a valid pattern, so leave it in unless you're testing something else deliberately.

Common Pitfalls

  • Greedy by default: ".*" on "a" and "b" matches the whole thing, quotes to quotes. Use the lazy form ".*?" to stop at the first closing quote.
  • Unescaped metacharacters: ., ?, (, + have special meaning. Matching a literal price like "9.99" needs 9\.99.
  • Invalid pattern = no matches: while you're mid-edit (e.g. an unclosed bracket), the tester simply shows zero matches instead of an error — keep typing.

Extracting URLs from your matches? Clean them up with the URL encoder, or validate JSON payloads first in the JSON formatter.

Frequently Asked Questions

What regex flavor does this tester use?
JavaScript's built-in RegExp engine — the same one running in browsers and Node.js. It supports groups, alternation, lookaheads, and Unicode. Patterns behave identically to new RegExp(pattern, flags) in your code.
Why do I get zero matches with a pattern I know is correct?
Most often the g flag is missing — the tester lists all matches, which requires it. Also check for unescaped metacharacters like . or ?, and add the i flag if casing might differ.
What regex flags can I use?
g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), and y (sticky) — any combination, e.g. "gim". The default is g so all matches are shown.
Will these patterns work in Python or PCRE?
Mostly. Core syntax (classes, quantifiers, groups, anchors) is shared, but some features differ — JavaScript has no possessive quantifiers, and named groups use (?<name>…). Test in the target engine before shipping.
Is my test data sent anywhere?
No. Pattern and test string are evaluated entirely in your browser — nothing leaves your device, so testing against logs or user data is safe.