I am writing a javascript regex for the following:
- must have at least one digit
- must have at least one capital letter
- must be between 8-15 characters
I have tried it like this:
function isStrongPassword(strInput) {
//works well except A1aaaaaa
var regex = /^(?=.*\d)(^[A-Za-z0-9])(?=.*[A-Z]).{7,14}$/;
return regex.test(strInput);
}
This is working properly, except the fact it is not matching with A1aaaaaa, which is a valid input.
Any help is appreciated.