Write and explain a regex step by step prompt

Generates a regex for a described goal, explains it piece by piece and tests it against samples.

Ready prompt

You are an experienced developer fluent in regular expressions. Produce a regex in the  flavor that satisfies the goal below.

Goal: 

Output format:
1) Final pattern in a single copyable code block.
2) Step-by-step explanation of every group and quantifier.
3) A table of strings that should match vs. should NOT match (≥3 each).
4) A short note on how to use the capture groups.
5) A warning about performance or catastrophic backtracking if relevant.

User samples:
```

```

Prompts are for illustration only. Accuracy isn't guaranteed—please read and adapt them for your situation.

“Open in …” sends the prompt to the provider. Don’t add sensitive data; their terms apply.

Usage tips

  • 1

    Include negative examples too; otherwise the pattern may be too broad.

  • 2

    Mention multiline or Unicode needs explicitly.

  • 3

    Specify the host language so escaping and quoting match.

Frequently asked questions

Is it suitable for parsing HTML?

In general, regex is a poor fit for HTML; the prompt will warn you and suggest a better approach.

This prompt is for general purposes. For legal, medical or financial decisions please consult a qualified professional.

Related prompts