Regex Builder With Test Cases
Writes a regular expression from examples, explains each part, and tests it against tricky cases.
ClaudeCode & Tech
81 words · free to use
Write a regular expression for me. Language/engine: [JavaScript / Python / PCRE / etc.] Should match: [EXAMPLES] Should NOT match: [EXAMPLES] Used for: [VALIDATION / EXTRACTION / SEARCH-AND-REPLACE] Give me the regex, a part-by-part explanation, a table of 10 test strings (including tricky edge cases I did not list) with expected match or no match, and the code to use it in my language. Warn me if a regex is the wrong tool for this job and suggest the better approach.
How to use this prompt
- Copy the prompt with the button above.
- Replace the parts in brackets with your own details: [JavaScript / Python / PCRE / etc.], [EXAMPLES], [VALIDATION / EXTRACTION / SEARCH-AND-REPLACE].
- Paste it into Claude and send it. It also works in other AI chat tools.
- Not quite right? Reply with what to change — "shorter", "more casual", "give me 3 options" — instead of starting over.