I need to create an additional method for the jQuery validate plugin, but I'm not great with regular expressions. What I need is to check if a text input is typed like I50xxxx OR i50xxxx, where xxxx are alphanumerics (0000 to 9999)
I made this :
jQuery.validator.addMethod("matricule", function(value, element) {
return this.optional(element) || /^I50\d{4}$/.test(value);
}, "Entrez un matricule valide (I50xxxx)");
It's Ok to check the first type, but not both. Can you help me?
(0000 to 9999)are numerics not alphanumerics