ToolUniverse

Regex Tester

Test JavaScript regular expressions against real text instantly — free, in your browser.

Frequently asked questions

Is my pattern or test text uploaded anywhere?
No. Every pattern is evaluated entirely in your browser — nothing you type is sent to a server or logged.
Which regex engine does this use?
The JavaScript (ECMAScript) regex engine, via the browser's built-in RegExp. Syntax and behavior can differ from Python, PCRE, .NET, or other regex dialects — a pattern that works here may need adjustment elsewhere.
Why did evaluation stop with a timeout message?
Pattern evaluation runs in a background worker with a timeout. If a pattern causes catastrophic backtracking (exponential-time matching on certain inputs), the worker is terminated and you're shown a timeout message instead of freezing the page.
Why are matches capped at 1000?
To keep results readable and the page responsive, at most 1000 matches are enumerated. If your pattern matches more than that, the results are marked as truncated.
Are the sample patterns production-ready?
No — the built-in samples (like the email-like or URL patterns) are simplified demonstrations. They may not be sufficient for security-sensitive validation; use a well-tested library for cases like real email or URL validation.
How accurate is the plain-English pattern explanation?
It's a best-effort, token-by-token explanation meant to help you read a pattern faster — not a full regex parser. For unusual or deeply nested syntax, treat it as a starting point rather than an authoritative breakdown.
What's the difference between greedy and lazy quantifiers?
Greedy quantifiers (*, +, ?, {n,m}) match as much text as possible before backtracking; their lazy counterparts (*?, +?, ??) match as little as possible. Both are supported here exactly as the JavaScript engine implements them.
What does catastrophic backtracking actually mean?
It's a pattern-matching failure mode where certain input strings force the engine into exponentially many backtracking attempts — most often caused by nested or adjacent quantifiers over overlapping character classes, like (a+)+. A pattern that runs instantly on short input can take seconds or minutes on a slightly longer crafted string.
What do the g, i, m, s, u, y, and d flags do?
g finds all matches instead of stopping at the first; i ignores case; m makes ^ and $ match at line boundaries within multiline text; s lets . match newlines; u enables full Unicode mode; y anchors matching to the current position (sticky); d adds match index information to results.
Why did my capture group show as undefined?
A capture group inside an alternation or optional part of a pattern only populates when that branch actually participates in the match — if the alternative branch matched instead, the group is undefined for that particular match, which is standard JavaScript regex behavior, not a bug in this tool.

You might also need

What is the Regex Tester?

The Regex Tester lets you build and debug JavaScript regular expressions against real text entirely in your browser. Enter a pattern and flags, paste the text you want to match, and see every match, capture group, and named group highlighted instantly — with an optional replace-mode preview and a plain-English, best-effort breakdown of the pattern. Regular expressions are notoriously easy to get subtly wrong — a quantifier that's greedy when it should be lazy, a character class missing an edge case, an anchor placed one character off. Testing a pattern against real sample text, rather than reasoning about it in the abstract, is the fastest way to catch those mistakes before they ship. This tool evaluates patterns using the same ECMAScript regex engine your browser and Node.js use, so what you see here is what your application will actually do — not an approximation from a different regex dialect. Pattern evaluation runs in a background worker rather than on the main thread, so a runaway pattern can't freeze the page. If a pattern triggers catastrophic backtracking — exponential-time matching that some crafted inputs can trigger in naive regex patterns — the worker is terminated and you're shown a timeout instead of a hung tab, which doubles as an early warning that the same pattern could be a denial-of-service risk if it ever runs against untrusted input in production.

Use cases

  • Debugging a regex used in application code or a validation rule
  • Extracting structured data (dates, log fields, IDs) from pasted text
  • Previewing a find-and-replace before running it in an editor or script
  • Learning what a pattern does via the best-effort plain-English explanation
  • Checking whether a pattern is vulnerable to catastrophic backtracking before using it on user input
  • Comparing greedy and lazy quantifier behavior on the same input side by side
  • Verifying named capture groups extract the fields you expect before wiring them into code
  • Testing a pattern against multiple sample lines at once using the multiline flag

How to use the Regex Tester

  1. 1

    Enter a pattern and flags

    Type a regular expression and toggle the flags you need (g, i, m, s, u, y, d).

  2. 2

    Paste your test text

    Paste the text to test against — matches highlight live as you type.

  3. 3

    Review matches or preview a replacement

    Inspect each match's groups, or switch on Replace mode to preview a substitution before using it elsewhere.

Examples

Extract dates

Created 2026-01-15, updated 2026-09-10.
2026-01-15, 2026-09-10

Named capture reformat

2026-09-10 → $<month>/$<day>/$<year>
09/10/2026

We use cookies for analytics and ads. Choose whether to allow them.