Password Validation with PHP and Regular Expressions
Password Validation with PHP and Regular Expressions
<form name="form1" action="#">
<ul>
<input type='password' name='text1'/>
<input type="submit" name="submit" value="Submit" onclick="CheckPassword(document.form1.text1)"/>
</ul>
</form>
<script>
function CheckPassword(input_txt) {
var password =/^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{7,15}$/;
if(input_txt.value.match(password)){
alert('Correct')
return true;
}
else{
alert('Wrong...!')
return false;
}
}
</script>
Comments
Post a Comment