I am writing a date validation function using jQuery, and seem to have run into a snag. Before I go into detail on the actual date, I run a quick regex to make sure that the format is right, but it is returning false on some dates that I know are valid. For instance, 01/22/2010 is fine, but it fails 11/22/2010. I know it has to be my regex string, but I don't know what I am doing wrong. Thoughts?
Code:
jQuery.validator.addMethod("date", function(value, element) {
var pass = this.optional(element) || /^(\d{2})(\/\d{2})(\/\d{4})$/.test(value);
if (pass == false) {
errorMsg = ('Must be in Date format mm/dd/yyyy');
return 0;
} else {
etc.