Regex Pattern Generator

Generate precise regular expressions for any pattern — email addresses, URLs, phone numbers — with a plain-English explanation of every component in the regex.

The prompt

Write a regular expression that matches the following pattern. Show the regex, explain each part of it, and provide 5 example strings that match and 3 that don't:

{{pattern}}

Works in ChatGPT, Claude, Gemini and other assistants. Replace the highlighted placeholders with your own content.

How to use it

Describe the pattern at {{pattern}} in plain English and add a few strings that should match and a few that should not. The prompt returns the regex with an explanation of each part.

Tips for better results

  • Always give negative examples. They catch over-broad patterns.
  • Name the regex flavor (JavaScript, PCRE, Python) because syntax differs.
  • Test the result on real data before shipping it.

Save this prompt in Promta

Keep it in your library and paste it from the menu bar, a hotkey or your iPhone keyboard, without leaving the app you're in.

Download Free on App Store

Free to start · iPhone & Mac

Related prompts

Browse all 60 prompts