Regex From Examples

Give match and non-match examples, get a regex plus a plain-English breakdown and extra test strings.

Intermediate1 min read

Customize

Fill these in and the prompt below updates as you type. Anything you leave blank stays as a placeholder.

Your prompt

3 placeholders left
Write a regex for {{flavor}} that matches the SHOULD-MATCH strings and rejects the SHOULD-NOT strings.

Should match:
{{should_match}}

Should NOT match:
{{should_not_match}}

Return: the regex, a plain-English explanation of each part, and 3 extra test strings you would add to be sure it is correct.

Similar prompts

Add Diagnostics Before Guessing

Instrument first, theorize second — logging with a stated plan for capturing the failure.

Add Types Incrementally

Type one file with runtime behavior frozen, and make the type-checker output the proof.

Adversarial Security Review

Have the AI attack your own code: ranked vulnerabilities, a concrete exploit for each, and the fix.

Bisect a Regression

Walk the history between a known-good commit and main to find the culprit diff.