text→regex

Regex Tester & Generator

Test a regex on your text, see what it matches, and get it explained in plain English.

Using toolbook means 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 an AI model built into your browser, on your device. The tester and explainer above work without it.

Checking what your browser can do…

Data sent from your device
0 bytes sent

Your files stay on your device

How to use it

Type a regular expression and paste some text to see every match highlighted, with capture groups and a plain-English explanation of each part. Your text stays on your device.

Type your pattern at the top and paste some sample text below. Every match lights up as you type, and you can see what each capture group caught.

Not sure what a pattern does? Each part is explained in plain English, step by step — handy for patterns someone else wrote.

The tool warns you about patterns that could freeze your browser, before you run them.

Using Chrome or Edge on desktop? Describe what you want to match in plain English and AI writes the pattern for you, then tests it against your text so you can check it really works.

Regex syntax reference

The building blocks of regular expressions. Paste any of these into the box above to see them explained and tested on 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 AI?

Yes. Testing, highlighting, groups, and explanations work in every browser. Only writing a pattern from a description needs AI.

Which kind of regex is this?

JavaScript. Most patterns work elsewhere too, but some features differ in Python, PHP, and Go.

Why does it warn about my pattern freezing?

Some patterns can take forever on text that doesn’t match, freezing the tab. The tool spots them before running.

Why didn’t the AI pattern do what I asked?

Built-in models vary and sometimes get it wrong. That’s why it’s tested on your text straight away — check the highlights and tweak it.

Can anyone else see my text?

No. Everything happens on your device.

How it worksFor the curious

Matching uses your browser’s own JavaScript regex engine, the authority on what a pattern means. Flags are honoured exactly: without g, exec returns only the first match, and the tool does not hide that.

Explanations come from a separate parser that reads the pattern into a tree — classes, quantifiers, groups, lookarounds, backreferences, anchors. If it meets a construct it does not model, it says it cannot explain that part rather than calling a valid pattern invalid.

Nested unbounded repetition — the (a+)+ shape — can backtrack catastrophically, and a running regex cannot be interrupted in JavaScript, so the tab would freeze. The shape is detected before running.

Generation uses your browser’s built-in language model. Small on-device models get regex wrong in plausible-looking ways, so the result is dropped into the tester rather than presented as an answer. Named groups, lookbehind, and Unicode property escapes differ in PCRE, Python, and Go.

Related tools