Regular Expressions 101

Community Patterns

Date Validation - Including Leap Year (mm/dd/yyyy)

0

Regular Expression
ECMAScript (JavaScript)

/
^(?:(?:(?:0[13578]|1[02])(\/)31)\1|(?:(?:0[1,3-9]|1[0-2])(\/)(?:29|30)\2))(?:(?:19|[2-9]\d)\d{2})$|^(?:02(\/)29\3(?:(?:(?:19|20)(?:[02468][048]|[13579][26]))))$|^(?:(?:0[1-9])|(?:1[0-2]))(\/)(?:0[1-9]|1\d|2[0-8])\4(?:(?:19|[0-9]\d)?\d{2})$
/
gm

Description

Loading markdown...
Submitted by anonymous - 4 years ago