Created
December 26, 2016 15:48
-
-
Save leandromoh/470b0b54208f02a9ba223cdbdd1534bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Regex to validate password strength | |
^(?=.*[A-Z].*[A-Z])(?=.*[!@#$&*])(?=.*[0-9].*[0-9])(?=.*[a-z].*[a-z].*[a-z]).{8}$ | |
Explanation: | |
^ Start anchor | |
(?=.*[A-Z].*[A-Z]) Ensure string has two uppercase letters. | |
(?=.*[!@#$&*]) Ensure string has one special case letter. | |
(?=.*[0-9].*[0-9]) Ensure string has two digits. | |
(?=.*[a-z].*[a-z].*[a-z]) Ensure string has three lowercase letters. | |
.{8} Ensure string is of length 8. | |
$ End anchor. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment