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?
What does ${pattern:email} mean?
Who wrote this prompt?
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.
