I want a regular expression to check that:
A password contains at least eight characters, including at least one number and includes both lower and uppercase letter
Try this:
^.*(?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=])[a-zA-Z0-9@#$%^&+=]*$
This regular expression works for me perfectly.
function myFunction() {
var str = "c1TTTTaTTT@";
var patt = new RegExp("^.*(?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=])[a-zA-Z0-9@#$%^&+=]*$");
var res = patt.test(str);
console.log("Is regular matches:", res);
}