This pattern validates all the possible dates for all months in YYYY-MM-DD format. Due to limitations of regex it can not validate the dates of february for leap year. It will allow the date 29 for leap year too. Make sure to validate that yourself.