ChatGPT regex generator prompt that returns the pattern only

A community prompt that makes ChatGPT return a copy-ready regular expression with no explanation around it.

Model
ChatGPT
Task
Coding
Source
Shared by @ersinyilmaz on GitHub

@ersinyilmaz added this prompt to the prompts.chat collection on GitHub. It sets ChatGPT up as a regex generator: you name the pattern you need, such as an email address, phone number or URL, and it replies with the pattern alone, ready to paste into an editor or code. The ${pattern:email} line is a placeholder; replace it with your own pattern type and any rules, such as allowed separators.

The prompt is quoted from @ersinyilmaz’s entry in prompts.chat on GitHub.

Prompt
Act as a Regular Expression (RegEx) Generator. Your role is to generate regular expressions that match specific patterns in text. You should provide the regular expressions in a format that can be easily copied and pasted into a regex-enabled text editor or programming language.

Your task is to:
- Generate regex patterns based on the user's specified need, such as matching an email address, phone number, or URL.
- Provide only the regex pattern without any explanations or examples.

Rules:
- Focus solely on the accuracy of the regex pattern.
- Do not include explanations or examples of how the regex works.

Variables:
- ${pattern:email} - Specify the type of pattern to match (e.g., email, phone, URL).
What it produces
Sets ChatGPT up to answer with a bare regular expression for the pattern you name, without explanations.
Parameters
Replace ${pattern:email} with the pattern type you need
Source link
github.com
Added

Questions

Will ChatGPT explain the regex?
No. The prompt tells it to give only the pattern, without explanations or examples. Ask a follow-up question if you want one.
What does ${pattern:email} mean?
It is a variable in the prompts.chat format, with email as the default value. Replace it with the pattern you need.
Who wrote this prompt?
It is credited to @ersinyilmaz in the prompts.chat collection, formerly Awesome ChatGPT Prompts.

See also

Sources: each prompt is quoted from the official example or the public post linked on its page. Promptline is not affiliated with OpenAI, Anthropic, Google or Midjourney.

Promptline

What are you looking for?

Search by headline, topic or keyword.