Test, validate and match regular expressions
This regex validates dates in YYYY-MM-DD format with optional time (HH:MM:SS.s), enforcing calendar rules including leap years. It uses a positive lookahead to verify valid date combinations (e.g., Feb 29 only in leap years, correct days per month) while capturing year, month, day, and optional time components separately. Ideal for form validation, date parsing, and datetime extraction in applications requiring strict date validation.