Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
^(1[0-2]|0{0,1}[1-9])\/(3[0-1]|2[0-9]|1[0-9]|0{0,1}[1-9])\/(2[0-1][0-9]{2})$
/

Description

Matches any short date string between 1/1/2000 - 12/31/2199 in the formats: d/m/yyyy, dd/m/yyyy, d/mm/yyyy, or dd/mm/yyyy

Submitted by anonymous - 8 years ago