I need to check whether my password contains one number and one character.
Input form
<input class="form-control" data-validate="required,minlength[8],alphaNumeric" id="password" name="password" placeholder="password" type="text">
Below is my jQuery validate method.
jQuery.validator.addMethod("alphaNumeric", function (value, element) {
return this.optional(element) || /^[0-9a-zA-Z]+$/.test(value);
}, "password must contain atleast one number and one character");
The problem is, the above regexp is not validating for the criteria where password
should contain at least one number and one character.