I need help with creating a regex to: at least 1 number, only letters in English, at least one special char (@!#$%^&*()-+_), no spaces and not 3 same letters in a row.
ty!
function passwordValidated() {
var password = document.getElementById("password").value;
var passMsg = document.getElementById("passMsg");
if (password.length > 6 && password.length > 12) {
passMsg.innerHTML = "password must contain above 6 charcters and below 12";
return false;
}
var specialChar = /[@!#$%^&*()-+_]/;
if (!specialChar.test(password)) {
passMsg.innerHTML = "password must contain a special character";
return false;
}
var numberCheck = /(?=\S* [\d])/;
if (!numberCheck.test(password)) {
passMsg.innerHTML = "password must contain at least one number";
return false;
}
passMsg.innerHTML = "";
return true;
}
this is my code for now.