Re: Regular Expresson for checking password strength

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



James Nunnerley wrote:
I want to have a regular expression that check the following criteria are
met by $password:

- contains at least 6 characters (any)
- has at least 1 letter
- has at least 1 number
- other 6 characters can be anything...

I'm happy to work out the structure of a postcode etc, but to be honest I'm
still fairly new to working with regular expressions.

What the best/easiest way to check whether a variable contains a range?  It
might be RegExp don't do this?

Cheers
Nunners

It can be done; but, it's simpler to simply to make an if() with
(strlen($password) > 5) && (strlen($password) < max) && pre_match("%[a-z]+%i"%, $password) && preg_match("%\d+%", $password)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux