What is the correct regular expression to use to validate a date like. 2009-10-22 or 2009-01-01 etc. Platform PHP
\d{4}-\d{2}-\d{2}
would match string in that form, but to check if date is valid, you'd had to break that string to year, month and date (you can use this regexp for that) parts and check each of them.
You can additionally, make sure that year must start with 1 or 2: [12]\d{3}-\d{2}-\d{2}
, and you can also do the same for month and day: [12]\d{3}-[01]\d-[0123]\d
(but I would go with the first regexp and compare parts "manually")