Community Patterns

Community Library Entry

7

Regular Expression
Created·2015-07-24 11:21
Flavor·ECMAScript (JavaScript)

/
^\d{4}-(((0[13578]|1[02])-(0[1-9]|[12]\d|3[0-1]))|(02-(0[1-9]|[12]\d))|((0[469]|11)-(0[1-9]|[12]\d|30)))$
/
gm
Open regex in editor

Description

Besides leap year handling, this takes care of date validation in the yy-mm-dd format.

Submitted by anonymous