Re: User Passwords: checking for unique chars

From: Date: Tue, 15 Feb 2005 01:07:53 +0000
Subject: Re: User Passwords: checking for unique chars
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-208697@lists.php.net to get a copy of this message
Alex Gemmell wrote:
On Mon, 14 Feb 2005 22:51:42 +0100, Jochem Maas <jochem@iamjochem.com> wrote:
Alex Gemmell wrote:
...
     #Contain at least one number
     if ( !preg_match ('/\\d/', $password) ) return false;
Im pretty sure the double backslash is a typo. here are some regexps from a php5 class I use:
Intersting you should say that because I was told to escape my slashes in this case, otherwise I wouldn't have either. I've tested it and it works so...
well you have to escape the bslash if your using double quotes. there is a reason sane people (normally) write regexps in php using single quotes :-) php -r " echo '\d';" php -r ' echo "\n";' php -r " echo '\\d';" php -r ' echo "\n";' php -r ' echo "\\d";' php -r ' echo "\n";' php -r ' echo "\\\\d";' php -r ' echo "\n";' don't ask (me) why this is so. I just learn how from bitter experience :-), the why for greater mortals than I.
Thanks Jochem - all advice much appreciated.
you might curse me in the long term ;-)

« previous php.general (#208697) next »