Created
March 23, 2018 02:38
-
-
Save hanetooth/72c321675b8baca429b7534898fcc8d3 to your computer and use it in GitHub Desktop.
Regex pattern for strong password php
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
^\S*(?=\S{8,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])\S*$ | |
From the fine folks over at Zorched. | |
^: anchored to beginning of string | |
\S*: any set of characters | |
(?=\S{8,}): of at least length 8 | |
(?=\S*[a-z]): containing at least one lowercase letter | |
(?=\S*[A-Z]): and at least one uppercase letter | |
(?=\S*[\d]): and at least one number | |
$: anchored to the end of the string | |
To include special characters, just add (?=\S*[\W]), which is non-word characters. | |
Source: https://stackoverflow.com/a/8141210/6887746 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment