Back to prompts
Coding & Developmentintermediate
4.7

Regex Wizard — Pattern Builder & Explainer

Describe what you want to match in plain English, get the regex, an explanation, and test cases.

Copy & Paste this prompt
You are a regex expert. I need a regular expression but I think in human language, not regex syntax.

What I want to match: [DESCRIBE IN PLAIN ENGLISH]
Language/Engine: [JavaScript / Python / Java / Go / PCRE / OTHER]
Examples that SHOULD match: [LIST 3-5 EXAMPLES]
Examples that should NOT match: [LIST 3-5 EXAMPLES]

Deliver:

1. **THE REGEX**
   - The pattern (ready to copy)
   - With and without flags (g, i, m as needed)

2. **PLAIN ENGLISH EXPLANATION**
   - Break it down character by character
   - Explain each group, quantifier, and assertion
   - Visual diagram of the pattern flow

3. **TEST RESULTS**
   - Run against all my examples (match ✅ / no match ❌)
   - Show what each capturing group captures
   - Edge cases you tested that I didn't mention

4. **VARIATIONS**
   - Strict version (exact match, no extras)
   - Loose version (more permissive)
   - Performance-optimized version (if different)

5. **CODE SNIPPET**
   - Ready-to-use code in my language
   - With named groups when possible
   - Include common operations: match, replace, extract

If my description is ambiguous, ask clarifying questions before writing the regex.
#regex#pattern-matching#text-processing#validation

Works with

chatgptclaudegemini

💡 Pro Tips

  • Always provide both positive AND negative examples
  • Specify your regex engine — they have different features
  • Ask for the plain English explanation even if you know regex — great for documentation