Text & chat prompt
Write a regex from a plain description
Write a regex from a plain description: a free, copy-paste prompt for ChatGPT, Gemini and Claude. Paste the prompt and replace each [BRACKETED] field with your own details.
The prompt
Write a regular expression. Language or tool: [e.g. JavaScript, Python, grep] It must match: [EXAMPLES THAT SHOULD MATCH] It must not match: [EXAMPLES THAT SHOULD NOT] Task: [FIND / VALIDATE / REPLACE] Give the regex, a part-by-part explanation, a test table of my examples with expected results and any edge cases to watch out for.
Pro tip: Always test with your real data. Regex answers from AI can be subtly wrong.
How to use this prompt
- Open ChatGPT and start a new chat.
- Paste the prompt.
- Replace each [BRACKETED] field with your real details and paste in your own text where asked.
- Reply with follow-ups such as "make it shorter" or "make it sound more like me".
Prompt at a glance
- Category
- Text & chat
- Works with
- ChatGPT · Gemini · Claude
- Length
- 55 words
- Fields to fill in
- EXAMPLES THAT SHOULD MATCH, EXAMPLES THAT SHOULD NOT, FIND / VALIDATE / REPLACE
- Last updated
Frequently asked questions
Which AI tools work with this prompt?
It is written for ChatGPT, Gemini and Claude. Paste it into your preferred tool and adjust the wording if the result is off.
What do I need to fill in?
Replace these fields before you send it: EXAMPLES THAT SHOULD MATCH, EXAMPLES THAT SHOULD NOT, FIND / VALIDATE / REPLACE. Each field shows an example in the prompt.
Should I paste private information into the prompt?
Only what the task needs. Remove names, contact details and other sensitive data before pasting a resume or document into any AI tool.