I have password constraints that i would like to validate:
- minimum length = 6
- upper case and lower case characters allowed
- at least 1 character (upper- or lowercase)
- at least 1 digit
- allowed special characters: _$#%&!?-.
Currently my regex looks like this:
/^(?=.*\d+)(?=.*[a-zA-Z])[0-9a-zA-Z\_\$\#\%\&!\?\-\.]{6,}$/
Except for the special characters, all requirements are met. Can anybody explain to me what i am doing wrong with the special characters? As you can see, every character is escaped and grouped into a “allowed” character class. However, the test still fails.
thank you
or