Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(19[2-9][\d]|20[0-2][\d])\W*(0[1-9]|1[0-2])\W*(0[\d]|1[\d]|2[\d]|3[0-1])
/
g

Description

Checks for date between 1920-01-01 through 2029-12-31 for validity, reformats to make sure the parts are separated by hyphens

Submitted by anonymous - 5 years ago