I want to validate password field. I have tried following code, but getting message that "Your password must satisfy the following...............", even though i enter a correct password format.
var re = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$/;
if ( !re.test(rpassword) )
{
alert('Your password must satisfy the following. \n\n* Password should be 4 to 8 character long. \n* Password should have at least one alphabet. \n* Password should have at least one numeric value. \n* Password should have special characters.');
return false;
}
Not getting what is wrong with this code. Please help !!