I am not very good with regex. I am being frustrated by a regular expression.
Example:
I have the following date time: 05/16/2013 12:00 am
I need a javascript regex that respect this format: mm/dd/yyyy hh:mm [am/pm]
var dateReg = /^[0,1]?\d{1}\/(([0-2]?\d{1})|([3][0,1]{1}))\/(([1]{1}[9]{1}[9]{1}\d{1})|([2-9]{1}\d{3}))$/;
if(!dateReg.test(inputVal)) {
$(this).after('<span class="error error-keyup-5">Invalid date format.</span>');
}
But this code works only for date, not with time. Thanks for your help.