I am trying to make a jquery validate rule that looks for a specific value pattern. However I am having problems where I get false positives.
here is my rule
Query.validator.addMethod("eidFormat", function (value, element) {
var a1formatChk = /[^b-z]\d{5}|\d{6}$/.test(value);
return e1formatChk;
}, "Your oder code needs to be your employee id. Please try again.");
the value I am looking for needs to be a and 5 or 6 digits. Also I am adding the rule on field change. either they need to add their employee id or leave the filed blank and I add a system generated id on the back end.
here is the problem I am having
if I enter b1234 it fails and gives me the message but if I put in garbage like fgkhjkjfhg54645 the test comes back true.
I am thinking this is more a reg ex pattern issue, but am not sure.
any help would be appreciated