💻 Codingintermediate4 variables

Create Regex Pattern

Generate and explain regular expression patterns.

regexvalidationparsing

Template

Create a regular expression to: {{purpose}} Requirements: - Programming language/flavor: {{regex_flavor}} - Input examples that should match: {{match_examples}} - Input examples that should NOT match: {{no_match_examples}} Please provide: 1. The regex pattern 2. Explanation of each part 3. Test cases 4. Any edge cases to consider

Variables to Fill In

1
{{purpose}}

What to match

Example: Validate email addresses

2
{{regex_flavor}}

Regex flavor

Example: JavaScript

3
{{match_examples}}

Should match

Example: user@example.com name.last@domain.co.uk

4
{{no_match_examples}}

Should not match

Example: invalid@ @nodomain.com

Example Usage

Variables Used:

purpose = Extract phone numbers
regex_flavor = Python
match_examples = 555-123-4567 (555) 123-4567
no_match_examples = 12345 abc-def-ghij

Result:

Create a Python regex to extract phone numbers matching formats like 555-123-4567 and (555) 123-4567.

Tips for Best Results

  • 1Be specific with your variables - the more detail you provide, the better the AI response.
  • 2Start with the example values if you're unsure, then customize based on your needs.
  • 3Iterate on the results - if the first response isn't perfect, refine your variables and try again.
  • 4Combine multiple templates for complex tasks that require different perspectives.