Cryonel

Regex Tester, Pattern Library & Explainer

Test a JavaScript-compatible regex against sample text, see matches live, and get a plain-English breakdown of what each part of the pattern means.

How to use it

Enter your regex (optionally with flags in /pattern/flags form), type the test text, and click Run Test. All matches and capture groups are listed below. Click Explain Pattern for a token-by-token, plain-English breakdown of what the regex does. To do a find-and-replace, fill in the Replacement field and click Replace.

Test the real engine and its worst cases

This page executes the browser's ECMAScript regular-expression engine. A pattern copied from PCRE, Python, Java, or another flavor may use different syntax or matching behavior, so confirm it in the runtime that will ship. Add positive, negative, empty, Unicode, multiline, and near-miss cases. Near misses matter for performance because nested quantifiers and overlapping alternatives can consume far more time when the input almost matches. The warning here is a useful heuristic, not a security proof; keep untrusted patterns and unbounded input out of production request paths.

What are Test Cases for?

Add several sample strings, mark each as "should match" or "should NOT match", then click Run All Tests to check your pattern against all of them at once — with a per-case execution time in milliseconds, so an unexpectedly slow case (a real, measured signal, not just a heuristic) stands out immediately.

Frequently Asked Questions

Which regex engine is used?

Your browser's built-in JavaScript (ECMAScript) regex engine — that's the only engine that can actually execute inside a web page. We don't offer a PCRE/Python/Java "flavor" switch, because without a real engine for each behind it, that would just be a label with no actual behavior change. Differences from ECMAScript are usually minor (e.g. possessive quantifiers and atomic groups aren't supported here).

How do I add flags?

Wrap your regex in slashes like /pattern/gi and the trailing letters are read as flags (g: global, i: case-insensitive, m: multiline, s: dotall).

How does the pattern explainer work?

It walks through your regex token by token — anchors, character classes, quantifiers, groups, escapes — and describes each one in plain English. It's a best-effort breakdown, not a formal parser, so unusual or deeply nested patterns may not be described perfectly.

What's the ReDoS warning?

Running a test also checks your pattern for the classic catastrophic-backtracking shape — a quantified group that's itself just one repeated atom, like (a+)+ or ([a-z]*)*. It's a heuristic for that one well-known shape, not a full analyzer — it won't catch every vulnerable pattern (e.g. overlapping alternation like (a|a)+), and a clean result isn't a guarantee.

How does Replace work?

It's the browser's native String.replace(), so standard replacement syntax works: $1/$2 for capture groups, $& for the whole match, $$ for a literal dollar sign. Leave it empty to delete every match instead.

Related Tools