Created
October 16, 2018 21:56
-
-
Save zainaali/248defd6ff03ff4ebd84d8da173ee586 to your computer and use it in GitHub Desktop.
password must contain only numbers and letters with limit regex
This file contains hidden or 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
<?php $password = 'abc'; | |
if (!preg_match('/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,12}$/', $password) ) { | |
$error['password_length'] = "Password must be at least 6 characters, containing at least one latter and one number"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment