Break down a regular expression token by token, or build one from a plain-English description, with example strings that match and one that fails.
You are a pattern-matching instructor who treats a regular expression the way a linguist treats a sentence, as a sequence of individual pieces that each carry meaning, rather than as one dense unreadable symbol, because once someone can name what each piece does, the whole pattern stops looking like noise. Work in [MODE:select:decode a regex I already have,build a regex from a description] mode. My regex flavor is [LANGUAGE:select:not sure,JavaScript,Python,generic PCRE style], since small differences, like how named groups or lookbehind are written, vary slightly between them. If I chose decode a regex I already have, my pattern is: [REGEX] If I left [REGEX] blank, ask me to paste it before doing anything else instead of inventing a pattern to explain. Break the pattern into its individual tokens in the order they appear, and for each one, name what kind of token it is, a literal character, a character class like `\d` or a custom set in brackets, an anchor like `^` or `$`, a quantifier like `*`, `+`, `?`, or `{2,4}`, a group defined with parentheses, or a lookahead or lookbehind, and state in plain language what that specific token contributes to the overall match. Then state, in one sentence, what the complete pattern matches as a whole. Provide two short example strings the pattern would match and one example string that looks similar but would not match, and explain exactly which part of the pattern causes that near-miss to fail. If I chose build a regex from a description, my description is [DESCRIPTION], written in plain English, such as match a US phone number with optional dashes, or match an email address with a standard format. If I left [DESCRIPTION] blank, ask me to describe what I want to match before doing anything else instead of guessing. Build the pattern incrementally, introducing one piece at a time and stating which part of my plain-English description that piece is responsible for, rather than presenting the finished regex all at once with no development shown. After assembling the complete pattern, provide the same test set as above, two strings it would match and one similar-looking string it would not, with the reason for the near-miss stated explicitly. If my description is ambiguous, for example whether a phone number should require dashes, allow them optionally, or reject them, state the assumption you are making and ask me to confirm or correct it rather than silently picking one interpretation. In either mode, if my description or pattern is trying to validate something with real-world edge cases that regex alone handles poorly, such as fully validating an email address's deliverability or a date's calendar validity, say so plainly and explain what the regex can and cannot guarantee, instead of presenting an imperfect pattern as a complete solution.
Use this prompt anywhere
10,000+ expert prompts for ChatGPT, Claude, Gemini, and wherever you use AI.
Get Early AccessA regular expression reads as one dense block of symbols until someone shows it's actually a sequence of small, individually meaningful pieces, a literal character, a quantifier, an anchor pinning the match to a string's start or end. This tool works in both directions.
Decode mode takes a pattern you already have in [REGEX] and breaks it into tokens in order, naming what each one is, a character class, a group, a lookahead, and what it contributes to the match. It states what the whole pattern matches in one sentence, then gives two strings that would match and one similar-looking string that would not, with the reason for that near-miss spelled out. Build mode goes the other way, starting from a plain-English [DESCRIPTION] like match a US phone number with optional dashes, assembling the pattern piece by piece and stating which part of the description each piece answers.
Set [LANGUAGE] to JavaScript, Python, or generic PCRE style, since small syntax differences like named groups and lookbehind support vary between flavors. If a description asks for something regex can't guarantee, like validating a date is real on the calendar, the tool says so instead of shipping an imperfect pattern as a complete answer. Run it in the Dock Editor to keep a library of explained patterns, pair with the code explanation generator when a regex sits inside a larger function, or the javascript code explainer for the syntax around it.
Paste this into ChatGPT, Claude, or Gemini, or open it directly in the Dock Editor. Set [MODE] to decode a regex you already have and don't understand, or build a regex from a plain-English description of what you want to match.
Choose [LANGUAGE] as JavaScript, Python, generic PCRE style, or not sure, so syntax details like named groups match the flavor you're actually using.
In decode mode, paste your pattern into [REGEX]. In build mode, describe the target in plain English in [DESCRIPTION], like match a phone number with optional dashes.
Decode mode names each piece of the pattern in order, character classes, quantifiers, anchors, groups, and states what each one contributes to the full match.
Both modes end with two example strings the pattern matches and one similar string that doesn't, with the specific reason for that near-miss explained.
Paste a confusing pattern copied from a tutorial or Stack Overflow and get it broken into named, individually explained pieces instead of one unreadable block of symbols.
Describe what you want to match in plain English, a US phone number, a hex color code, a simple email format, and get a pattern built piece by piece with the reasoning shown.
Your regex matches most of your test cases but silently fails on one specific string. Use decode mode to find exactly which token in the pattern is responsible for the near-miss.
Set [LANGUAGE] to compare how the same pattern idea, like a named capture group, is written differently between JavaScript and Python regex syntax.
Discover more prompts that could help with your workflow.
Build a small working program that calls a real public API, with the request, response, and API key setup explained step by step.
Explain a core functional programming idea, such as pure functions or immutability, with a broken code example and its fixed version shown side by side.
Explain a built-in math function, square root, power, absolute value, or rounding, covering math and syntax, then generate practice calls to predict before revealing results.
10,000+ expert-curated prompts for ChatGPT, Claude, Gemini, and wherever you use AI. Our extension helps any prompt deliver better results.