Coding

Regex generator and explainer

Describe a matching pattern in plain language, list a few strings it must reject, and name the language or regex engine, and get back a working regular expression. It comes with a token-by-token breakdown of what each part does, a callout of edge cases it might mishandle like unicode, empty strings, or catastrophic backtracking, and three example strings that should match plus three that shouldn't.

Prompt
Build a regular expression for the following:

What it needs to match:
{{describe}}

What it must NOT match:
{{list_example_strings}}

Language or engine:
{{language}}

Provide:
1. The regular expression.
2. A token-by-token explanation of what each part does.
3. Edge cases the pattern might mishandle (unicode, empty strings, catastrophic backtracking risk, case sensitivity).
4. Three test strings that should match and three that should not.
Download .md

Variables