What is a regex tester?

A regex tester takes a regular expression and sample text, runs the pattern against the text, and shows you every match, usually with the matching characters visually highlighted, the index where each match starts, and any captured groups expanded. It is the fastest way to debug a regex that "almost works" without round-tripping through your application code.

ZipKit's Regex Tester runs entirely client-side. Your pattern and your sample text never leave your browser, which matters when the test data contains emails, tokens, customer IDs, or anything else you can't paste into a third-party site.

How to use this tool

1. Type or paste a pattern into the slash-bracketed input. Don't include the surrounding /.../, the tool adds them visually. 2. Toggle flags with the small chips: g (global, find every match), i (case-insensitive), m (multiline ^/$), s (dot matches newlines), u (Unicode), y (sticky). 3. Replace the sample text with whatever you actually want to match against. Highlights update on every keystroke (180 ms debounce). 4. Inspect the match list below the test text, index, length, capture groups, named groups.

The "Common patterns" card on the right loads 20 production-tested regexes (email, URL, IPv4/IPv6, UUID, hex color, hashtag, slug, …), click any of them to drop the pattern into the input.

Regex flags, briefly

  • g (global), return every match instead of just the first. Most testers leave this on by default.
  • i (ignore case), match Email and EMAIL and email interchangeably.
  • m (multiline), make ^ and $ match at every line break, not just the start/end of the whole string.
  • s (dotAll), let . match \n. Useful when you want a single regex to span multiple lines.
  • u (unicode), enable proper Unicode handling, including astral plane characters and \p{Letter} property escapes.
  • y (sticky), only match starting from lastIndex. Specialised; you usually want g, not y.

What the engine actually runs

This tool uses the browser's native RegExp engine, the same engine your JavaScript code will use in production. There's no translation layer, no PCRE shim, no Python re semantics. If a pattern matches here, it matches in your code; if it errors here, it errors in your code with the same message.

That means PCRE-only features won't work: no possessive quantifiers (a++), no atomic groups ((?>...)), no backtracking control verbs. JavaScript regex supports lookbehind ((?<=…) / (?<!…)) since modern engines, named groups ((?<name>…)), and Unicode property escapes (\p{…}) when the u flag is set.

Capture groups

When your pattern uses parentheses, each parenthesised sub-pattern is a capture group. The tool lists groups under each match, numbered group 1, group 2, … in the order their opening paren appears. If a group's body never matched (because it was inside an alternation that took the other branch), the tool shows (undefined).

For named groups, (?<year>\d{4})-(?<month>\d{2}), the names appear directly under the group list, so you can copy field names straight out of the tester into your code.

Match-count and performance

The tester caps at 5,000 matches per run to keep the page responsive. Patterns with catastrophic backtracking (e.g. (a+)+b against a 50-character a-string) will pin a CPU core for several seconds, the browser may even mark the page unresponsive. If the tool feels slow, simplify the pattern or use anchors (^, $, \b) to constrain the search.

Common gotchas

  • Forgot \b, cat matches inside concatenate. Add word boundaries when you want whole-word matches.
  • Greedy vs lazy, <.> matches <b>bold</b> as one big chunk. Use <.?> (lazy) to match each tag separately.
  • Escaping in source code, JavaScript strings double backslashes. \\b in a string literal becomes \b in the regex. The tester takes the raw regex, not a JavaScript-string-escaped version.
  • g and lastIndex, RegExp.prototype.exec with the g flag advances lastIndex each call. The tester resets it for you, but be aware of this in your own code.

Privacy

Your pattern, your test text, and the match results stay in your browser. Nothing is sent to a server. Recent inputs are stored only in your browser's local storage and can be cleared from the "Recent" card.

Frequently asked

Does this tool send my pattern or test data to a server?

No. The pattern and the test text are passed straight to your browser's native RegExp engine. Nothing is uploaded, logged, or persisted server-side. Only the pattern field is saved to your browser's localStorage as a 'recent input', and you can remove items from that list at any time.

Which regex flavour does this tool support?

JavaScript regex (ECMAScript), the same engine your front-end code runs. PCRE-only features like possessive quantifiers, atomic groups, and recursive subroutines won't work — but lookbehind, named groups, and Unicode property escapes (with the 'u' flag) do.

How do I use a flag like case-insensitive or multiline?

Click the 'i' chip below the pattern field for case-insensitive, 'm' for multiline (^/$ match per line), 's' for dot-matches-newline, 'u' for Unicode mode, and 'y' for sticky matching. Active flags appear in the box at the right end of the pattern bar.

Why doesn't my pattern match anything?

Most often: forgotten word-boundary (\b), greedy vs lazy quantifier mismatch, or an escaped character that didn't need escaping. Drop the pattern in piece-by-piece — first match the broad shape, then add the constraints — and watch the highlights update.

What's the difference between greedy and lazy quantifiers?

Greedy quantifiers (*, +, ?) try to match as much as possible, then back off if needed. Lazy versions (*?, +?, ??) try to match as little as possible. For HTML tag extraction <.*> matches one big span ending at the LAST '>'; <.*?> matches each tag individually.

Are named groups supported?

Yes. Use (?<name>...) to name a capture group. The tester shows named groups under each match in addition to the numbered groups, so you can verify your data extraction reads cleanly.

How many matches will this tool show?

Up to 5,000 matches per run. If your pattern matches more than that, the tool stops at the cap to keep the page responsive — usually a sign that the pattern is too broad and needs anchors or word boundaries.

Can I paste a pattern that includes the slashes (e.g. /foo/g)?

No — paste only the body. The tool adds the surrounding /.../ visually and reads flags from the dedicated flag chips. Strip the slashes and the trailing flag letters before pasting.