Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^(?<Monthswith31>31(?<s1>\/|\.|-)(0?[13578]|1[02]|(Jan|Mar|May|Jul|Aug|Oct|Dec))\g<s1>(?<Year>19[0-9][0-9]|200[0-7]))$|^(?<Monthswith29or30>(29|30)(?<s2>\/|\.|-)(0?[1,3-9]|1[0-2]|(Jan|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec))\g<s2>(?<Year2>19[0-9][0-9]|200[0-7]))$|^(?<Allmonthswith28>(0?[1-9]|1[0-9]|2[0-8])(?<s3>\/|\.|-)(0?[1-9]|1[0-2]|(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec))\g<s3>(?<Year3>19[0-9][0-9]|200[0-7]))$|^(?<FebLeapYears>29(?<s4>\/|\.|-)(0?2|Feb)\g<s4>(19([02468][048]|[13579][26])|200[04]))$
/
gm

Description

no description available

Submitted by anonymous - 4 years ago