Regular Expressions 101

Community Patterns

Community Library Entry

-1

Regular Expression
PCRE (PHP <7.3)

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

Description

Regex for date in ISO 8601 format that also check the number of day in a month to be sure the date is valid

Submitted by anonymous - 7 years ago