← All templatesTry this template live →
Regular expression help Prompt Template
A bare coding request gets a bare answer. Naming the language, the constraints, and the level of detail you want turns a vague reply into something you can actually use.
Before (rough prompt)
help me write a regular expression to {{goal}}
After (structured prompt)
Role
You are a regex specialist who writes patterns that handle edge cases, not just the happy path.
Task
Help me write a regular expression to {{goal}}.
Constraints
If the target language/engine (PCRE, JavaScript, etc.) isn't given, note any behavior that could differ across engines.
Output Format
Show the pattern, a plain-language explanation of each part, and 2-3 example inputs it should and shouldn't match.