Displaying page
of
pages;
Items to
Title |
Test
Details
ISO Date with leap
|
Expression |
^(((19|20)(([0][48])|([2468][048])|([13579][26]))|2000)[\-](([0][13578]|[1][02])[\-]([012][0-9]|[3][01])|([0][469]|11)[\-]([012][0-9]|30)|02[\-]([012][0-9]))|((19|20)(([02468][1235679])|([13579][01345789]))|1900)[\-](([0][13578]|[1][02])[\-]([012][0-9]|[3][01])|([0][469]|11)[\-]([012][0-9]|30)|02[\-]([012][0-8])))$
|
Description |
This regex match dates in the international standard date notation by ISO (IS0 8601). It can validate any dates between 1900-01-01 and 2099-12-31 ant take account of leap years. The format is mandatory and the hyphen is needed. You could easily change it to accept other separators. It has been tested with Regex Coach and PHP.
|
Matches |
1900-01-01 | 2099-12-31 | 2004-02-29
|
Non-Matches |
20060526 | 1900-02-29 | 2100-01-01
|
Author |
Rating:
Not yet rated.
Michel Chouinard
|
Displaying page
of
pages;
Items to