I have the following pattern to validate a password form (not ideal, I know, but it’s for an assignment).
/^(?=[a-zA-Z0-9]{8,})(?=[a-zA-Z]*[0-9][a-zA-Z]*$)[a-zA-Z0-9]+$/
My idea is, I need the password to be at least 8 letters long, and include at least one number and one letter. It also cannot include any special characters.
It accepts password1
as a password, but it does not accept password12
as a password. How can I fix this?