Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(0[1-9]|1[0-2])[\/\-](0[1-9]|1[\d]|2[\d]|3[01])[\/\-](\d{2,4})
/
gm

Description

FInds a valid date string in the formats mm-dd-yy or mm/dd/yy, as well as mm-dd-yyyy and mm/dd/yyyy.

Submitted by anonymous - 5 years ago