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.
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
Translate pseudocode to correct code prompt
Turns algorithmic pseudocode into idiomatic, testable code in a target language.
Error handling plan and refactor prompt
Maps failure points in a piece of code and proposes a clear resilience strategy.
Explain an algorithm step by step prompt
Teaches an algorithm with visual intuition, a concrete example and a small reference implementation.
Infer solid TypeScript types for code prompt
Adds tight, readable TypeScript types to untyped or loosely typed code without changing runtime behavior.