Last Updated: February 25, 2016
·
490
· medesko

Passwords Regex Function

//Passwords must be at least 6 characters long with one uppercase letter and one number


function strongpassword($str) { return (!pregmatch('/^(?=^.{6,}$)((?=.[A-Za-z0-9])(?=.[A-Z])(?=.[a- z]))^.$/', $str)) ? false : true; } </code> </pre>