Write a Regular Expression From a Description

Turn a plain-English matching rule into a correct, readable regex — with a breakdown and test cases.

0 likes 0 dislikes
Sign in to rate this prompt

Prompt

    Write a regular expression for the requirement below.

What it should match, in plain English, with examples of strings that SHOULD and SHOULD NOT match:
{{requirement}}

Flavor / language (e.g. PCRE, JavaScript, Python re, RE2): {{flavor}}

Please:
1. Give the regex.
2. Break it down piece by piece in plain language.
3. Run it against my examples — which match, which don't — and note edge cases I should consider (anchoring, greediness, Unicode, escaping).

Prefer a readable pattern over a clever one. If my examples are ambiguous or contradictory, point that out instead of guessing which I meant.

Like this prompt?

Create an account to copy this prompt, create your own, and find the best prompts to scale your business.