Regex Pattern Builder
Create and explain regular expressions
codingregexpatternsvalidation
Prompt Template
Create a regular expression that {description}.
Language/flavor: {flavor}
Provide:
1. The regex pattern
2. A breakdown explaining each part
3. Test cases that match
4. Test cases that should NOT match
5. Edge cases to be aware ofVariables
{description}Example: validates email addresses including subdomains
{flavor}Example: JavaScript
Example Output
```javascript
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
```
**Breakdown**:
- `^[a-zA-Z0-9._%+-]+` — local part...Tips
- Specify the regex flavor (JS, Python, etc.)
- Include edge cases you're worried about