Regular Expressions 101

Community Patterns

regex for iso 8601 date between 1970 and 2999

1

Regular Expression
ECMAScript (JavaScript)

/
^(19[789]\d|2\d{3})-((0[13578]|1[02])-([0-2]\d|3[01])|02-[0-2]\d|0[469]|11-([0-2]\d|30))T([01]\d|2[0-4])(:[0-5]\d){2}Z$
/

Description

regex for iso 8601 date between 1970 and 2999 that match only valid date, the only mistake possible in this regexp is the bisextile year how are not checked

Submitted by KurayamiNoDaiTenshi - 8 years ago