Title |
Test
Find
Pattern Title
|
Expression |
^[0-9]{4}-(((0[13578]|(10|12))-(0[1-9]|[1-2][0-9]|3[0-1]))|(02-(0[1-9]|[1-2][0-9]))|((0[469]|11)-(0[1-9]|[1-2][0-9]|30)))$ |
Description |
Matches the date format "YYYY-mm-dd" and also validates month and number of days in a month. All leap year dates "YYYY-02-29" passes trough. Could easily be changed to another format. |
Matches |
2004-04-30 | 2004-02-29 |
Non-Matches |
2004-04-31 | 2004-02-30 |
Author |
Rating:
Johan Södercrantz
|
Source |
|
Your Rating |
|
Title: invalid leap years
Name: Tester
Date: 7/27/2005 3:31:46 AM
Comment:
Your regular expression does not fullt validate leap years... example : 2003-02-29 is validated but it's not an existnig date