Help me write and understand regular expressions for my use case.
What I need to match: [DESCRIBE THE PATTERN]
Language: [JAVASCRIPT / PYTHON / PHP / JAVA / OTHER]
Examples of valid input: [GIVE EXAMPLES]
Examples of invalid input: [GIVE EXAMPLES]
Provide:
1. **Pattern Design**: Build the regex step by step with explanation
2. **Character Classes**: Which characters and groups to match
3. **Quantifiers**: How to handle repetition and optional parts
4. **Anchors**: Start, end, and word boundaries
5. **Groups & Captures**: Extracting specific parts of the match
6. **Lookahead/Lookbehind**: Advanced patterns when needed
7. **Test Cases**: Full list of inputs and expected results
8. **Common Patterns**: Regex for email, URL, phone, date, etc.
9. **Performance Notes**: Avoiding catastrophic backtracking
10. **Debugging Tips**: Tools and techniques for testing regex
Help me write and understand regular expressions for my use case.
What I need to match: [DESCRIBE THE PATTERN]
Language: [JAVASCRIPT / PYTHON / PHP / JAVA / OTHER]
Examples of valid input: [GIVE EXAMPLES]
Examples of invalid input: [GIVE EXAMPLES]
Provide:
1. **Pattern Design**: Build the regex step by step with explanation
2. **Character Classes**: Which characters and groups to match
3. **Quantifiers**: How to handle repetition and optional parts
4. **Anchors**: Start, end, and word boundaries
5. **Groups & Captures**: Extracting specific parts of the match
6. **Lookahead/Lookbehind**: Advanced patterns when needed
7. **Test Cases**: Full list of inputs and expected results
8. **Common Patterns**: Regex for email, URL, phone, date, etc.
9. **Performance Notes**: Avoiding catastrophic backtracking
10. **Debugging Tips**: Tools and techniques for testing regex
How to use this prompt
Copy the prompt above and paste it into ChatGPT, Claude, Gemini, or any AI assistant. Replace the bracketed placeholders with your specific details.
Leave a Review
Tried this prompt? Let us know how it worked — your reviews help other users find the best prompts.