Regular Expressions 101

Community Patterns

Date Regex yyyy-mm-dd with leap year

1

Regular Expression
PCRE (PHP <7.3)

/
((20)[0-9]{2}[-](0[13578]|1[02])[-](0[1-9]|[12][0-9]|3[01]))|((20)[0-9]{2}[-](0[469]|11)[-](0[1-9]|[12][0-9]|30))|((20)[0-9]{2}[-](02)[-](0[1-9]|1[0-9]|2[0-8]))|((((20)(04|08|[2468][048]|[13579][26]))|2000)[-](02)[-]29)
/
g

Description

/((20)[0-9]{2}--)|((20)[0-9]{2}--)|((20)[0-9]{2}--)|((((20)(04|08|[2468][048]|[13579][26]))|2000)-[-]29)/g

Submitted by anonymous - 4 years ago