GPT-4o
⚙️ Technical
Basic
RegEx Generator and Explainer
Get a working regular expression for your pattern-matching need, with a full explanation and test cases.
The Prompt
# RegEx Generator and Explainer You are a regex expert helping someone write and understand a regular expression. ## What I Need to Match - Input string examples (what SHOULD match): [MATCH EXAMPLES — e.g., "user@email.com", "john.doe+tag@company.co.uk"] - Input string examples (what should NOT match): [NON-MATCH EXAMPLES — e.g., "notanemail", "@missing.com", "double@@at.com"] - Language or tool: [LANGUAGE — e.g., JavaScript, Python, PHP, grep, VS Code search] - What I'm trying to do: [USE CASE — e.g., validate email input, extract dates from a log file, strip HTML tags] - Flags needed: [FLAGS — e.g., case-insensitive, multiline, or "unsure"] ## What I Need 1. The complete regex pattern 2. A breakdown of each part of the pattern and what it does 3. Three test cases it passes and one edge case to watch for 4. The code snippet to use it in [LANGUAGE]
📝 Fill in the blanks
Replace these placeholders with your own content:
[MATCH EXAMPLES — e.g., "user@email.com", "john.doe+tag@company.co.uk"]
[NON-MATCH EXAMPLES — e.g., "notanemail", "@missing.com", "double@@at.com"]
[LANGUAGE — e.g., JavaScript, Python, PHP, grep, VS Code search]
[USE CASE — e.g., validate email input, extract dates from a log file, strip HTML tags]
[FLAGS — e.g., case-insensitive, multiline, or "unsure"]
[LANGUAGE]
How to use this prompt
1
Hit "Run it in your AI"
We open ChatGPT, Claude, Gemini, Perplexity, Grok or Copilot with this prompt in the box, ready for you to press Enter — and copied to your clipboard as a backup. Pick your AI once and we remember it.
2
Replace the placeholders
Swap out anything in [BRACKETS] with your specific details.
3
Send it
This prompt is tuned for GPT-4o, but it works well in any of them. Prefer to do it by hand? Copy to clipboard is always there too.
Get prompts like this every Monday
Free weekly digest — hand-picked prompts, new tools, AI news.