Hi,
I have a password field which must contain at least one (1) UPPER CASE letter, one (1) LOWER CASE letter, one (1) numeric DIGIT: (0,1,2,3,4,5,6,7,8,9), one of the special characters (!@#$%^&+_|~-=\{}[]:?/),not contain more than 2 identical consecutive characters (AAA, iiii, $$$$$ ...) and at least 8 characters long
Eg: TbM&htr1.
I am trying to do the above by the following:
function validate( str ) {
var i = 0, c;

while( c = str.charAt( i++ ) )
{
if( c === str.charAt(i) &&
c === str.charAt(i+1)
) {
return false;
}
}
return true;
}


function validateChangePassword(){
var oldPass = document.getElementById('ed_pass').value;
var newPass = document.getElementById('ed_pass_new').value;
var cPass = document.getElementById('ed_cpass_new').value;
var re = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])/;
if(oldPass == ''){
alert("Please provide your old password.");
document.change_pass.ed_pass.focus();
return false;
}
if(newPass == ''){
alert("Please type new password.");
document.change_pass.ed_pass_new.focus();
return false;
}
else if(newPass != ''){
if(validate(newPass) === false){
alert("Cannot consecutive character...");
document.change_pass.ed_pass_new.focus();
return false;
}
}

if(newPass.length < 8){
alert("New password should be more than 8 characters in length.");
document.change_pass.ed_pass_new.focus();
return false;
}
if(newPass != cPass ){
alert("Confirm password is not matching, please type correct one.");
document.change_pass.ed_cpass_new.focus();
return false;
}
}
But by these two functions, I am unable to validate the mandatory special characters (!@#$%^&+_|~-=\{}[]:?/). Please help me how to do that.

Thanks in advance.