← Back to articles
ChatGPT Tips, Software Engineering • Jun 04, 2026
ChatGPT Tip: Generate Regex Carefully
Regex needs examples and counterexamples.
Regex needs examples and counterexamples.
Best way to use it:
• Provide matching examples.
• Provide non-matching examples.
• Ask for explanation and tests.
Copy-ready prompt:
Create a regex for [task]. It should match: [examples]. It should not match: [counterexamples]. Explain it and provide test cases.
Quality check:
• Examples pass.
• Counterexamples fail.
• Escaping fits your language.
DropTicks note:
Use ChatGPT like a workstation, not a magic answer box. Give it the role, goal, input material, constraints, expected output format, and review criteria. The stronger your workflow, the better the result.
Related source links:
• https://help.openai.com/en/collections/3742473-chatgpt
• https://help.openai.com/en/articles/6825453-chatgpt-release-notes
• https://openai.com/index/introducing-chatgpt-search/
• https://openai.com/index/introducing-deep-research/
• https://openai.com/index/introducing-canvas/
Community
Signals and discussion
0 likes
0 comments
No comments yet. Be the first to add a useful note.