Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
^([1-9]|0[1-9]|1[012])([-\/.])([1-9]|0[1-9]|[12][0-9]|3[01])\2(\d{4})$|^(\d{4})([-\/.])([1-9]|0[1-9]|[12][0-9]|3[01])\6([1-9]|0[1-9]|[12][0-9]|3[01])$
/

Description

Verifica se o texto digitado corresponde a um formato de data valida por expl. 12/31/2015 ou 2015/12/31

Submitted by Gustavo Américo (Gag) - 10 years ago