I'm using this:
jQuery.validator.addMethod("regex2", function(value, element, param) {
return value.match(new RegExp("." + param + "$"));
});
$("#phonenumber").rules("add", { regex2: "[0-9]+"})
to validate a phone. The phone number must be at least 7 digits long, the I got this regex from elsewhere and am using the parameter minlength=7
, but this is obviously unsuitable. How should this validation be done?
I live in Venezuela. So I think this is useless. How can I change it? In my country 0416-414 33 44 should be considered a valid input for a phone number.