text→regex

Regex Tester & Generator

Run a pattern against your own text, see the matches and capture groups, and read it back token by token in plain English.

By opening this website or using its tools, you agree to our Terms and Privacy Policy.

//gm

Matches

Contact us at hello@toolyard.dev or support@example.co.uk. Order #10432 shipped on 2026-08-14, order #9981 on 2026-07-02. Call +44 20 7946 0958 between 09:00 and 17:30.

Describe a pattern in plain English

Optional. Uses your browser's own on-device model — the tester and explainer above need no model at all.

Checking what this browser can run…

Network activity during processing
0 bytes uploaded

Your file never leaves your browser during processing

How it works

To test a regular expression, type the pattern above and paste sample text below it — every match is highlighted live, capture groups are listed per match, and the pattern is explained token by token in plain English. All of it runs in your browser using the browser’s own regex engine, so nothing is uploaded.

Matching uses your browser’s own regular expression engine, which is the only authority on what a pattern actually means — the same engine your JavaScript will run against. Flags are honoured exactly as you set them rather than quietly adding the global flag to show every match: without g, exec really does return only the first match, and a tester that hides that teaches the wrong thing.

The explanation comes from a separate parser that reads the pattern into a tree and describes each part in order — character classes, quantifiers, groups, lookarounds, backreferences, anchors. It is intentionally kept apart from the matching: if the explainer meets a construct it does not model, the page says it cannot explain that part rather than reporting your pattern as invalid, because the engine has already accepted it.

Patterns that nest one unbounded repetition inside another — the (a+)+ shape — are flagged before you run them. On text that does not match, an engine can spend exponentially long trying every way to split the input, and JavaScript offers no way to interrupt a running regular expression, so the tab simply stops responding. Detecting that shape ahead of time is the only defence available in a browser.

The English-to-regex generator is the optional layer on top. Where your browser provides an on-device language model it will write a pattern from a description, drop it into the field, and immediately run it against your test text — so you can see whether it matches what you meant instead of taking it on trust. Small on-device models get regular expressions wrong in ways that look plausible, which is exactly why the generated pattern is put through the tester rather than presented as an answer.

Regex syntax reference

The constructs the explainer covers, which is most of what JavaScript regular expressions offer. Anything here can be pasted into the field above to see it described in context and run against your own text.

Common JavaScript regular expression syntax.
PatternMatches
.Any character except a line break — any character at all with the s flag
\d \w \sA digit; a letter, digit or underscore; any whitespace
\D \W \SThe negation of each of the above
[abc] [^abc] [a-z]One character from a set, not from a set, or from a range
^ $Start and end of the string — of each line with the m flag
\b \BA word boundary, and a position that is not one
* + ?Zero or more, one or more, optional
{3} {2,} {2,5}Exactly, at least, or between — repetition counts
*? +? {2,5}?The same, but lazy: match as few characters as possible
(abc) (?:abc)A capture group, and a group that only groups
(?<name>abc) \k<name>A named capture group, and a backreference to it
(?=abc) (?!abc)Lookahead: what follows must, or must not, match
(?<=abc) (?<!abc)Lookbehind: what precedes must, or must not, match
a|bEither alternative

FAQ

Does this work without an AI model?

Yes. Testing, highlighting, capture groups, replacement preview, and the plain-English explanation are all deterministic and work in every browser. Only generating a pattern from an English description needs a model, and that model is your browser’s own.

Is my pattern or test text sent anywhere?

No. Matching uses your browser’s built-in regex engine and the explanation is produced by a parser running on this page. The live network counter below the tool shows zero bytes sent during processing.

Which regex flavour is this?

JavaScript, because it runs on your browser’s own engine. Most patterns transfer to other languages, but named groups, lookbehind, and Unicode property escapes have different syntax or availability in PCRE, Python, and Go.

Why does it warn about catastrophic backtracking?

Because a pattern with one unbounded repetition nested inside another can take exponentially long on text that does not match, and a running regular expression cannot be interrupted in JavaScript — the tab freezes. The warning is raised from the pattern’s structure before it runs.

Why did the generated pattern not do what I asked?

Browsers provide different on-device models and there is no way for a page to find out which one it got, so quality varies. That is why the generated pattern is immediately run against your test text: check the highlights before using it, and edit it by hand if it is close but wrong.

Related tools