I am having a password change page where I want to validate my password with "2 small letters, 2 capital letters, 3 symbols, 2 digits and so on. Now from the below code I am able to just validate the password in sequence like "aa, KK,ap, JK, 90, 89" but not working for " aK9Ju, a^rtH, hGT5$u etc.
I am just pasting code for small letters, If you want I can provide the entire code.
psw.onkeyup = function() {
var LC = jsonData.LOWERCASE;
var psw = document.getElementById("psw").value.replace(/([a-z])\d+/g, '$1');
var lowerCaseLetters = new RegExp('[a-z]{' + LC + '}', 'g')
if(psw.match(lowerCaseLetters)) {
letter.classList.remove("invalid");
letter.classList.add("valid");
} else {
letter.classList.remove("valid");
letter.classList.add("invalid");
}
So, My requirement is what ever the way I put my password it should validate the same.