Regex for password must contain at least eight characters, at least one number and both lower and uppercase letters and special characters

前端 未结 30 3716
伪装坚强ぢ
伪装坚强ぢ 2020-11-21 04:28

I want a regular expression to check that:

A password contains at least eight characters, including at least one number and includes both lower and uppercase letter

30条回答
  •  时光说笑
    2020-11-21 04:54

    Import the JavaScript file jquery.validate.min.js.

    You can use this method:

    $.validator.addMethod("pwcheck", function (value) {
        return /[\@\#\$\%\^\&\*\(\)\_\+\!]/.test(value) && /[a-z]/.test(value) && /[0-9]/.test(value) && /[A-Z]/.test(value)
    });
    
    1. At least one upper case English letter
    2. At least one lower case English letter
    3. At least one digit
    4. At least one special character

提交回复
热议问题