I have a username and password input field and I'm using the jquery validation plugin to validate my form. I know how to create custom rules and all but I'm just wondering how to write the regexp for it.
I want the password to be:
1) minimum 8 characters (this is taken care of by minlength in rules)
2) Contain a symbol (!@#$%^&*?~`'")
3) Contain a number (0-9)
jQuery.validator.addMethod("password", function(value, element) {
return this.optional(element) || /.../i.test(value);
}, jQuery.format("Enter correct password"));
I just don't know how to write the regex to search the input and see if it contains at least 1 symbol and 1 number. Any ideas? Thanks