[Solved] Javascript regular expression that matches at least 2 character (with special characters included) 2 numbers and max length of 8


var regexTests = {
  "Needs at least 2 letters or special characters": /(.*[A-Z!@#$%^&*()_+\-=[\]{}|;:<>?,./]){2,}/i,
  "Needs at least 2 digits": /(.*\d){2,}/,
  "Needs at least 8 total characters": /.{8,}/
};

function testText(txt) {
  return Object.keys(regexTests).filter(function(error) {
    return !regexTests[error].test(txt);
  });
}

console.log(testText("12"));
console.log(testText("gg"));
console.log(testText("g1"));
console.log(testText("g11f"));
console.log(testText("23df78sd"));

solved Javascript regular expression that matches at least 2 character (with special characters included) 2 numbers and max length of 8