The format of the regex is mm/dd/yyyy.
My current regex currently has a tiny problem, which I could not pinpoint. I could validate mm/dd/yyyy with valid months, leap year and year range. Although when the year written is '2016asdf' it still accepts the value.
The rules it should follow are:
- Only valid dates are allowed
- Feb 29 can be counted if it is a leap year
- Year value ranges from 1900 - 2099
Valid values:
12/31/2016
01/15/1900
02/29/2016 (since 2016 is a leap year)
Invalid values:
1/01/1900 (since format is 'mm' not 'm')
01/32/1900 (since there's no such date)
13/22/1900 (since there's no such month)
03/01/2100 (beyond the year limit)
02/29/2017 (since 2017 is not a leap year)