Password must be between 8 - 12 characters. Password must include three of the following: Upper case letter, lower case letter, number and special character: ! @ # $ % ^ * ~ : ; & > < [ ] { } | - _ + = ?
I have tried below code but I was only able to validate- To allow 8-12 characters However I was NOT able to filter this regex to include any three of the following characters- Upper case letter, lower case letter, number and special character.
Code snippet tried:
var pass = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^*~:;&><\[\]{}|\-_+=?])[A-Za-z\d!@#$%^*~:;&><\[\]{}|\-_+=?]{8,32}/;
if("Tesst@###123".match(pass)) {
console.log("valid");
} else {
console.log("NOT valid");
}