Dopamine AI Prompt Library
Open search
Menu
Submitted by
leo_s29 prompts

Regular Expressions taste

Added Nov 26, 2026

Prompt

regular-expressions-taste.mdMarkdown · 21 lines · about 580 tokens
# Regular Expressions taste of a developer who wants regexes people can still read
- Reach for a real parser for HTML, JSON, CSV, URLs and email headers; a regex is the wrong tool there. Confidence: 0.95
- Prefer plain string methods like `startsWith`, `includes` or `split` when they do the job. Confidence: 0.85
- Anchor patterns with `^` and `$` (or `\A` and `\z`) when validating a whole value. Confidence: 0.90
- Use named capture groups instead of counting numbered groups. Confidence: 0.85
- Use non-capturing groups `(?:...)` when you only need grouping, not the captured value. Confidence: 0.75
- Write long patterns in verbose mode with comments, such as `re.VERBOSE` in Python or the `x` flag where supported. Confidence: 0.80
- Prefer specific character classes like `[^"]*` over a lazy `.*?` to make intent clear and matching faster. Confidence: 0.80
- Avoid nested quantifiers like `(a+)+`; they invite catastrophic backtracking and ReDoS. Confidence: 0.95
- Never run user-supplied patterns without a timeout or a linear-time engine like RE2. Confidence: 0.90
- Put a length limit on input before matching it against any non-trivial pattern. Confidence: 0.85
- Compile patterns once at module level and reuse them instead of rebuilding them in a loop. Confidence: 0.75
- Escape dynamic text with `re.escape` or an equivalent helper before putting it into a pattern. Confidence: 0.95
- Turn on the Unicode flag (`u` or `v` in JavaScript) when the input may contain non-ASCII text. Confidence: 0.80
- Remember that `\d` and `\w` can match non-ASCII digits and letters in some engines; use `[0-9]` when you mean ASCII. Confidence: 0.70
- Keep each regex to one job; two simple patterns beat one clever pattern. Confidence: 0.80
- Give every important pattern a table-driven test with strings that must match and strings that must not. Confidence: 0.90
- Add a comment with a real example input above any pattern longer than about twenty characters. Confidence: 0.80
- Do not validate email addresses with a giant regex; check for one `@` and send a confirmation email. Confidence: 0.85
- Use lookarounds sparingly; if a pattern needs several of them, split the logic into code. Confidence: 0.70
- Try patterns in a tester like regex101 with the right engine selected before shipping them. Confidence: 0.70

About this prompt

Content type
Code
Industries
Software Development
Models
GPT
Languages
English
Length
21 lines, about 580 tokens
Added
Nov 26, 2026
License
CC0
Request takedown
leo_s29 prompts
Profile

More from leo_s

View all

prompt for powerpoint slides generation

Prepare prompt for investor ready pitch deck for coachingbuddy app. CoachingBuddy app is India’s modern coaching discovery app that helps students and parents find the best coaching classes, academies, and training institutes near them. From school tuitions to competitive exam coaching, hobby classes, and sports academies—CoachingBuddy brings everything into one easy-to-use platform.

Symphony Event Interviewer

Act as an Event Interviewer. You recently attended a symphony event and your task is to gather feedback from other attendees. Your task is to conduct engaging interviews to understand their experiences. You will: - Ask about their overall impression of the symphony - Inquire about specific pieces they enjoyed - Gather thoughts on the venue and atmosphere - Ask if they would attend future events

Rephraser with Obfuscation

I would like you to act as a language assistant who specializes in rephrasing with obfuscation. The task is to take the sentences I provide and rephrase them in a way that conveys the same meaning but with added complexity and ambiguity, making the original source difficult to trace. This should be achieved while maintaining coherence and readability. The rephrased sentences should not be translat

1Sentence Deck: pitch deck thesis interview

You are running the 1Sentence Deck method from 1sentencedeck.com. Follow it exactly. Interview me using the method’s own questions, one at a time. Wait for my answer before the next question. Never invent numbers or facts for me. The questions, in order: Why are you doing this? For who, who exactly has this problem and how many exist? Why aren’t existing solutions working? How are you doing it? Ho