PromptDev
Write a regex from a description
Describe what to match, list examples of both kinds, and get a pattern with a piece-by-piece explanation — plus its honest limits.
Last updated
Fill in the blanks
Assembled in your browser — nothing you type is stored or sent anywhere.
Your prompt
Write a regular expression (JavaScript) that matches: order IDs like ORD-2026-00042: the prefix ORD, a year, then a 5-digit number.
It MUST match all of these:
ORD-2026-00042
ORD-1999-00001
It must NOT match any of these:
ORD-26-00042
ord-2026-00042
ORD-2026-42
Give the pattern, then explain it piece by piece, then list what it deliberately does not handle. Verify it against every example above before answering — if the requirements conflict, or an example can't be satisfied, say which and why instead of handing me a pattern that fails them. Prefer a readable pattern over a maximally clever one.
Model-agnostic — works in Claude, ChatGPT, Gemini or any AI chat.
Why this prompt works
- →Positive AND negative examples turn a vague description into a testable spec — most bad generated regex comes from prompts that only said what should match.
- →"Verify before answering" makes the model run its own pattern against your examples, which catches the majority of first-draft errors.
- →Asking for deliberate limits up front beats discovering them in production — every practical regex has them.