This is not good to use Regex with every piece of well-structured data, such as date, because this might be already done for you. The better idea is: try to parse data to required structure and see if it succeeds or not. It gives you the really ultimate validation, and, as a big bonus, the structured object itself.
In case of date and Javascript, good thing to use is
$.datepicker.parseDate(format, value, settings)
:
http://api.jqueryui.com/datepicker[
^].
You can parse the string to the date format you define yourself. And with this method, you don't have to use the
datepicker
control itself. However, why not? Using it would be a good idea. If you do it, you may never need to do the parsing per se. :-)
—SA