Regular Expressions 101

regex for iso 8601 date between 1970 and 2999

Open Workspace
  • JavaScript
  • Match
1

Regular Expression

/
^(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