Test, validate and match regular expressions
This complex regex matches valid calendar dates in formats like YYYY-MM-DD, YYYY/MM/DD, or YYYYMMDD. It validates month/day combinations (e.g., Feb 29 only in leap years) and optionally enforces consistent separators. Key features include conditional patterns based on separator presence and lookahead/lookbehind to avoid partial matches in longer digit sequences.