Regex Pattern Builder

LW
@Lisa Wang
4 days ago
Fork

Create a regular expression pattern for: {{requirement}}

Regex Flavor

{{regex_flavor}}

Examples to Match

{{match_examples}}

Examples NOT to Match

{{no_match_examples}}


Deliverables

1. The Pattern

/your-regex-here/flags

2. Pattern Breakdown

Explain each part:

Part Meaning ... Explanation

3. Test Cases

Should Match ✓

For each example:

  • Input: ...
  • Captures: ...
Should NOT Match ✗

For each example:

  • Input: ...
  • Why it doesn't match

4. Code Examples

JavaScript:

const regex = /pattern/flags;
const result = text.match(regex);

Python:

import re
pattern = r"pattern"
result = re.findall(pattern, text)

5. Edge Cases

  • What this pattern DOESN'T handle
  • Potential false positives
  • Performance considerations for large text

6. Alternative Patterns

If multiple approaches exist, show:

  • Simpler (less precise)
  • More comprehensive (handles more cases)

Variables 4

Requirement {{requirement}}
e.g., Validate email addresses, Extract phone numbers, Parse URLs
Regex Flavor {{regex_flavor}}
e.g., JavaScript (ECMAScript), Python, PCRE, Java
Examples to Match {{match_examples}}
e.g., john@email.com, user.name+tag@domain.co.uk
Examples NOT to Match {{no_match_examples}}
e.g., not-an-email, @missing-local.com, spaces in@email.com