JQuery authentication password validation in upper and lower case

$.validator.addMethod("validpassword", function(value, element) {
    return this.optional(element) ||
}, "The password must contain a minimum of one lower case character," +
           " one upper case character, one digit and one special character..");


The above regex does not distinguish between uppercase and lowercase letters. What's wrong?


source to share

1 answer

Remove the flag i

. This makes RegEx case insensitive . Also, stretch [\W]

up to [\W_]


//                                           Remove this   ^

// Ok:




All Articles