Just a quick password policy function in php. Didn’t want to have to dig around to figure out how to do it again, so I’m just posting it here

/* * * * * * * * * * * * * * * * * * * * * * * * *
Password Policy requires
– at least 8 characters
– at least 1 lower case
– at least 1 upper case
– at least 1 digit
* * * * * * * * * * * * * * * * * * * * * * * * * /
function pwdPolicy($pwd){
   $policy = “/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/”;
   if(preg_match($policy, $pwd, $matches)){
      return true;
   } else return false;
}