Write a regular expression (Regex)

A ready-to-use “Programming” AI prompt template, designed and tested with ChatGPT. Replace the (bracketed) parts below with your own needs.

Prompt template
Write a regular expression: 1) give the regex per the need; 2) break it down explaining what each part matches; 3) give 5 matching and 5 non-matching examples; 4) point out common mismatch traps and a more robust way to write it.

What I want to match: "describe the rule, e.g., Taiwanese mobile numbers"
Language used: "e.g., JavaScript"

How to use this prompt

  1. Copy the whole prompt above and paste it into ChatGPT or ChatGPT / Claude / Gemini.
  2. Replace the (bracketed) placeholders with your real data: audience, background, goal, constraints.
  3. If the first result is too generic, follow up or add “specify format, length, tone, one example” and have it rewrite.

Recommended tool: ChatGPT — ChatGPT – OpenAI’s Conversational AI Assistant