0
Write a regex with an explanation and a battery of test cases
Write a regular expression that matches: pattern_description
Flavor/engine: {{regex_flavor, e.g. PCRE / Python re / JS RegExp}}
Requirements:
1. Show the regex itself first, then a plain-English breakdown of each group/token, no jargon without explanation.
2. Provide a table of at least 8 test strings: half that should match (including tricky edge cases within scope) and half that should NOT match (including near-misses that a naive regex would wrongly accept), with the expected result for each.
3. State explicitly what the regex deliberately does NOT handle, if the description implies edge cases that would make the pattern unreadable to cover (e.g. fully RFC-compliant email addresses).
4. If a non-regex approach (e.g. a proper parser) would be meaningfully more correct for this task, say so, but still provide the best-effort regex if I asked for one.
5. Avoid catastrophic backtracking; note any risk points if the pattern uses nested quantifiers.