OmniTools
developerDifficulty: 3/5

Regex Tester

Test JavaScript regular expressions against sample text with live matches, capture groups, named groups and clear syntax errors.

Enter the pattern only — no leading or trailing slash.

Flags
Why some patterns are refused: A regular expression engine can take exponential time on a crafted pattern, and JavaScript gives no way to cancel a match once it has started — so a bad pattern freezes the tab rather than returning slowly. This tool therefore checks the pattern shape first and refuses the known-explosive forms, and additionally caps the pattern length, the subject length and the number of matches collected. Note that compiling a pattern is not eval: a regex describes text to look for and cannot execute code.

How it works

  1. Type a regular expression, without the surrounding slashes.
  2. Choose the flags you want, then paste the text to test against.
  3. Matches, capture groups and highlighting update as you type, entirely in your browser.
Privacy & Processing: Everything runs in your browser. Your pattern and your test text are never uploaded, stored, or sent to analytics.

Frequently Asked Questions

Which regex flavour is this?

JavaScript, using the browser’s own RegExp engine — so what you see here is exactly what your JavaScript or TypeScript code will do. Patterns that rely on PCRE or Python features, such as recursion or possessive quantifiers, are not supported because the engine does not support them.

Does it execute my code?

No. The pattern is compiled with the RegExp constructor, which accepts only a pattern — it cannot run arbitrary JavaScript. There is no eval and no Function constructor anywhere in this tool.

Why was my pattern refused?

Some patterns backtrack catastrophically: (a+)+$ against a long run of a’s followed by a b takes exponential time, and JavaScript cannot interrupt a running match. Rather than freeze your tab, the tool detects those shapes — a quantifier applied to a group that itself ends in a quantifier, and overlapping alternations — and declines to run them. The check is deliberately conservative, so it occasionally refuses a pattern that would have been fine.

Are capture groups shown?

Yes: numbered groups, named groups, and the exact character offsets of every match. A group that did not participate in a match is shown as null rather than being omitted, since that distinction matters when you read the result in code.

Related Tools