Regular expression for validating date in javascript

See Recipes 3.5 and 3.15 for help implementing this regular expression with other programming languages. Character classes allow you to match any one out of a set of characters.

Browsers that support this input type give inconsistent behavior when these attributes are omitted.

The first group can optionally be enclosed with parentheses, and the first two groups can optionally be followed with a choice of three separators (a hyphen, dot, or space). It’s important that the hyphen appears first in this character class, because if it appeared between other characters, it would create a range, as with .

The following layout breaks the regular expression into its individual parts, omitting the redundant groups of digits: ^ # Assert position at the beginning of the string. Any quantifier that allows something to be repeated zero times effectively makes that element optional.

Validating user input is the bane of every software developer’s existence.

When you are developing cross-browser web applications this task becomes even less enjoyable due to the lack of useful intrinsic validation functions in Java Script.