Task prompt · Coding

Write a regex and explain it

by Agent Yard Team

Regex that works, with test cases.

You'll attach

Text only

Works with

ChatGPTClaudeGeminiGrokCopilotGrok Bot

Use cases

  • Regex that works, with test cases.
  • Reuse it as often as you like: fill in the blanks (language or tool; what to match; what to exclude) with new details and copy again.
  • With ChatGPT, Claude, Gemini and more, the AIs that support what this prompt needs.

How to use it

  1. Open chatgpt.com or claude.ai (or another AI listed here).
  2. Fill in the highlighted blanks ([LANGUAGE OR TOOL], [WHAT TO MATCH], [WHAT TO EXCLUDE]) below, or edit them after pasting.
  3. Copy the prompt, paste it into the chat and send.

Fill in the blanks (optional)

Prompt

Remix
Write a regular expression for [LANGUAGE OR TOOL] that matches: [WHAT TO MATCH].
It must NOT match: [WHAT TO EXCLUDE].

Give the pattern, a piece-by-piece explanation, 8 test strings (4 that should match, 4 that shouldn't) with expected results, and warn me about edge cases it misses.
One email a week

The best new prompts and personas, nothing else.

The Weekly is presented byyour brandSponsored · open

More Coding prompts

Footer partner · openThis strip runs at the foot of every page. One partner at a time.Ask about it →