password validation in javascript
علی ذوالفقار
1399/07/16 09:52:41 (933)
check a password between 7 to 15 characters which contain at least one numeric digit and a special character
https://www.w3resource.com/javascript/form/password-validation.php
function CheckPassword(inputtxt) {
var paswd= /^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{7,15}$/;
if(inputtxt.value.match(paswd)) {
alert('Correct, try another...')
return true;
}else{
alert('Wrong...!')
return false;
}
}