Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save scalp42/6cf984a6b02198b5d02f to your computer and use it in GitHub Desktop.

Select an option

Save scalp42/6cf984a6b02198b5d02f to your computer and use it in GitHub Desktop.
PASSWORD_VALIDATOR = /( # Start of group
(?: # Start of nonmatching group, 4 possible solutions
(?=.*[a-z]) # Must contain one lowercase character
(?=.*[A-Z]) # Must contain one uppercase character
(?=.*\W) # Must contain one non-word character or symbol
| # or...
(?=.*\d) # Must contain one digit from 0-9
(?=.*[A-Z]) # Must contain one uppercase character
(?=.*\W) # Must contain one non-word character or symbol
| # or...
(?=.*\d) # Must contain one digit from 0-9
(?=.*[a-z]) # Must contain one lowercase character
(?=.*\W) # Must contain one non-word character or symbol
| # or...
(?=.*\d) # Must contain one digit from 0-9
(?=.*[a-z]) # Must contain one lowercase character
(?=.*[A-Z]) # Must contain one uppercase character
) # End of nonmatching group with possible solutions
.* # Match anything with previous condition checking
)/x # End of group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment