Regex: Minimum 8 Characters at least 1 UpperCase 1 LowerCase 1 number and 1 Special Character

Last Reply on Jun 04, 2013 05:08 AM By Mudassar

Posted on Jun 04, 2013 05:08 AM

i need code to check the password policy using javascript for my change password page 

and the password policy should :

length of password :10-12
min 1 uppaercase
min 1 lowercase
min 1 special char
and min 1 integer

please reply soon..... 

Posted on Jun 04, 2013 05:08 AM

This way

 

    <input type="text" id="textbox1" value="Pass@1234" />
    <input type="button" id="Validate" onclick="ValidatePassword()" value="Validate" />
    <script type="text/javascript">
        function ValidatePassword() {
            var regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[#$@!%&*?])[A-Za-z\d#$@!%&*?]{10,12}$/;
            var txt = document.getElementById("textbox1");
            if (!regex.test(txt.value)) {
                alert("Password strength is not good.");
            } else {
                alert("Password strength is good.");
            }
        }
    </script>

Demo

I agree, here is the link: http://e-iceblue.com/free-api