Regex Explainer

Paste any regular expression and get a plain-English, piece-by-piece breakdown of what it actually does - plus a live tester below it that runs entirely in your browser, so you can try the pattern against your own text with nothing uploaded.

  • Global - find all matches, not just the first

Try it against your own text

Runs instantly in your browser as you type - nothing is sent anywhere for this part.

Frequently asked questions

How does this tool explain a regular expression?

It sends your pattern to a free AI language model, which breaks it into its meaningful pieces - a character class, a quantifier, a group - and writes a plain-English explanation for each one, along with a couple of example strings that would match and a couple that look similar but wouldn't. Regular expression syntax is famously dense and easy to misread even for people who write them often, so the goal here is to turn a cryptic line of symbols into something you can actually reason about at a glance.

Is my pattern or my test text sent to a server?

The regex pattern itself is sent to a free AI model to generate the plain-English explanation - that part genuinely can't run in a browser, since it takes real language understanding rather than fixed logic. The 'try it against your own text' box underneath, however, is completely separate: it runs the pattern through your browser's own regex engine, locally, and nothing you type there is ever sent anywhere. If you're testing a pattern against sensitive text, that live-testing box is the part to use - the AI explanation only ever sees the pattern itself, never your test data.

What's the difference between the AI explanation and the live tester?

The AI explanation answers 'what does this pattern mean' in plain language - useful when you're reading someone else's regex, or one you wrote a while ago and no longer remember. The live tester answers a different, more concrete question: 'does this pattern actually match this specific text' - it runs your browser's real regex engine against whatever you paste, highlighting every match instantly as you type. Together they cover both understanding a pattern and confirming it behaves the way you expect.

Does this support every regex flavor, or just JavaScript's?

The live tester specifically uses JavaScript's built-in regex engine (the same one Chrome, Firefox, Node.js and every browser use), so a pattern that's valid JavaScript regex will test correctly here. The AI explanation is more flexible in practice - it will do its best to explain patterns written for PCRE, Python's `re` module, or other common flavors too, though small syntax differences between flavors (like named group syntax, or lookbehind support) mean the live tester below might reject a pattern that a different language's engine would accept.

Why does it say 'Not a valid pattern'?

That means the pattern has a JavaScript regex syntax error - a common cause is an unclosed group or bracket (like a stray `(` with no matching `)`), an invalid quantifier range (like `{5,2}`, where the minimum is larger than the maximum), or a flag combination JavaScript doesn't support. The error message shown comes directly from the browser's own regex engine, so it's the same message you'd get trying to use that pattern in real JavaScript code - a useful signal on its own for debugging.

Can I test my own text without it being sent anywhere?

Yes - that's exactly what the 'try it against your own text' section is for. It runs entirely with your browser's built-in RegExp engine, the same one that powers any JavaScript running on the page, and involves zero network requests. You can paste sensitive text there with confidence; only the pattern itself (never the test text) is ever sent to the AI model, and only when you click 'Explain this pattern.'

What do the 'Would match' and 'Would not match' examples mean?

They're short, realistic example strings the AI generated to illustrate the pattern's behavior concretely, rather than only abstractly. The 'Would match' examples show strings the pattern is expected to accept; the 'Would not match' examples deliberately look similar but fail for a specific, explainable reason - like being one character too short, using the wrong separator, or missing a required part. Reading both sides together is often faster than reading the plain-English summary alone for building real intuition about a pattern's edges.

Does this help me write a new regex, or only explain existing ones?

It's built specifically for the second case - explaining a pattern that already exists, whether it's one you wrote a while ago, one you found in someone else's code, or one from a tutorial or Stack Overflow answer that you want to actually understand before using. It's not a generator that writes a pattern from a plain-English description; it works in the other direction, decoding a pattern that's already written.

Which regex flags are supported?

All of JavaScript's standard flags: `g` (global - find every match, not just the first), `i` (case-insensitive), `m` (multiline, changing what `^` and `$` match), `s` (dotall, letting `.` match newlines too), `u` (unicode mode), `y` (sticky matching) and `d` (match indices). Type any combination into the Flags field and the tool lists what each one does, right below the input, so you don't have to remember them all.

Is the AI explanation always 100% accurate?

It's generally reliable for common, everyday patterns - email validation, URL matching, phone number formats, and similar - but like any AI-generated explanation, it can occasionally misdescribe an unusual or deeply nested pattern, especially one using less common regex features. The live tester below is the more trustworthy source of ground truth for any specific text, since it's running the actual regex engine rather than a language model's description of one - when the two seem to disagree, trust the live tester's real match results over the written explanation.

Can I use this to study for a coding interview or learn regex?

Yes - pasting in patterns from a regex tutorial, a coding-interview prep sheet, or documentation you're trying to understand, and reading the piece-by-piece breakdown alongside the match/non-match examples, is a genuinely effective way to build real intuition for how regex syntax behaves, faster than reading a reference table of symbols in isolation.

Does this tool store or log the patterns I explain?

No account, login, or history is required or kept by this tool - each explanation is a single, stateless request to the AI model with no record kept afterward, the same as every other tool on this site. As with any request sent to a third-party AI model, avoid pasting a pattern that itself contains sensitive literal data (like a real password or personal ID baked directly into the regex text) - though this is rarely how real-world patterns are written in the first place.

Related tools