Last Updated: February 25, 2016
·
556
· 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>

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#php
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside