Can someone help me with this regex password validation for rails?
It currently is set to ensure:
- Password should contain at least one integer.
- Password should contain at least one alphabet(either in lowercase or uppercase).
- Password can
have special characters from 20 to 7E
ascii values. - Password should be
minimum of 8 and maximum of 40
characters long.
How can I remove the one single decimal digit rule?
/^(?=.*\d)(?=.*([a-z]|[A-Z]))([\x20-\x7E]){8,40}$/
I’m going to recommend against a monolithic regex to test all of your password requirements. It seems much easier to write them as lots of small statements:
Its a bit more self-documenting to future maintainers, and a lot easier on the eyes.