This question already has an answer here:
Can someone elaborate the following regular expression:
if($pass == $re_pass) {
//password validation
$pattern_up = "/^.*(?=.{4,56})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).*$/";
if(!preg_match($pattern_up, $pass)) {
$errPass = "Must be at lest 4 character long, 1 upper case, 1 lower case letter and 1 number exist";
}
}
what I want to achieve is to check the entered password is between the number of 4 and 56. I already specified it in the code. However, when I tried, it can accept more than that range.
My question, is how i can specify the upper limit, i dont want to exceed 56 characters long. And if you can elaborate it more, so i can understand it more. this code is not made by me.
Thanks,
I am trying to do sign up page in php
if($pass == $re_pass) {
//password validation
$pattern_up = "/^.*(?=.{4,56})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).*$/";
if(!preg_match($pattern_up, $pass)) {
$errPass = "Must be at lest 4 character long, 1 upper case, 1 lower case letter and 1 number exist";
}
}
</div>