Enforcing Password Requirements

I want to check if the user has successfully met the following requirements:

  • The password has at least 8 characters
  • Consists of one capital & one lowercase letter

How would I do this?

I am using the PHP script below:

if ( strlen( $password ) < 8 ) {
     false
} else {
   if ( preg_match( "/[^0,9]/", $password ) ) {
     // how to check the upper case and lower case
   }
}
13
задан tshepang 1 May 2014 в 00:47
поделиться