I need a regular expression for a password field.
The requirement is:
The password Must be 8 to 20 characters in length
Must contain at least one letter and one number and a special character from !@#$%^&*()_+
.
Should not start with a special character
I have tried
^(?=.*[a-zA-Z])(?=.*d)(?=.*[!@#$%^&*()_+])[A-Za-zd!@#$%^&*()_+]{8,20}
It works but how do you restrict special characters from beginning the password? Also if you have a more efficient regex than the one mentioned above please suggest.
Thank you
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…