Community Patterns

Community Library Entry

1

Regular Expression
Created·2015-09-22 17:59
Flavor·ECMAScript (JavaScript)

/
^(0[1-9]|1[0-2])-([1-9]|[12][0-9]|3[01])-(\d{4})$
/
Open regex in editor

Description

This is a regular expression for date in javascript. It validates the month between 01-12 (double digits only). It validates the day between 01-31 (double digits only). And enforces 4 digit year (no validation for range).

Submitted by Andrew Leonenko