Re: User Passwords: checking for unique chars

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

 



Alex Gemmell wrote:
On Mon, 14 Feb 2005 22:51:42 +0100, Jochem Maas <jochem@xxxxxxxxxxxxx> 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 ;-)

--
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