php password validation regex

Solutions on MaxInterview for php password validation regex by the best coders in the world

showing results for - "php password validation regex"
Elisa
05 Oct 2017
1$uppercase = preg_match('@[A-Z]@', $password);
2$lowercase = preg_match('@[a-z]@', $password);
3$number    = preg_match('@[0-9]@', $password);
4
5if(!$uppercase || !$lowercase || !$number || strlen($password) < 8) {
6  // tell the user something went wrong
7}
8
Lysander
11 Sep 2017
1^(?=\P{Ll}*\p{Ll})(?=\P{Lu}*\p{Lu})(?=\P{N}*\p{N})(?=[\p{L}\p{N}]*[^\p{L}\p{N}])[\s\S]{8,}$
2