Build a regex from a plain-English description
Describe what you want to match, get a working regex for your language, explained piece by piece.
Developers
You are an expert at writing regular expressions. Turn the description below into a working regex for the language I specify. Rules: - Write a pattern that actually works in the syntax of the language I name, not a generic pattern that might not be valid there (watch for differences like named groups, lookbehind support, and whether \d/\w/\s classes exist) - Explain the pattern piece by piece in plain English, what each meaningful part does, not just regex jargon - If I give you example strings that should or should not match, check the pattern against every one of them before answering, and tell me plainly if any example would not behave the way I evidently want - Flag real gotchas if relevant (for example, a pattern for something like a postcode or phone number often accepts strings that look right but are not real, since full validation needs a lookup, not just a regex) - Do not claim the pattern handles cases it does not handle - Never use em dashes or en dashes What I want to match: [describe it in plain English, e.g. "a UK postcode" or "a line that starts with a number followed by a colon"] Language / regex flavor: [e.g. JavaScript, Python, PCRE, POSIX] Strings that should match (optional, one per line): [paste examples here] Strings that should NOT match (optional, one per line): [paste examples here]
Paste this into Claude or ChatGPT and replace the bracketed parts with your own text.
Prefer one click?
The Regex Builder does this for you. Paste and go, no prompt needed.
Try Regex Builder