I am trying to write a regex that:
- starts with a letter
- contains one uppercase and one lowercase letter
- contains one number
- does not allow special characters
- minimum 8 characters
So far I have the upper/lowercase conditions, the number and minimum character requirements set with the following regex:
/^(?=.*?[a-z])(?=.*?[A-Z])(?=.*?[0-9]).{8,}$/
My best guess at resolving the starts with a letter
and does not allow special characters
requirements are below. This regex seems to evaluate all input to false
:
/^[a-zA-Z](?=.*?[a-z])(?=.*?[A-Z])(?=.*?[0-9]).{8,}$/