note 71536 deleted from function.preg-quote by felipe
| From: | felipe@php.net | Date: | Mon, 10 Dec 2007 02:21:41 +0000 |
| Subject: | note 71536 deleted from function.preg-quote by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133105@lists.php.net to get a copy of this message | ||
Note Submitter: chad
----
If you are placing your quoted string within []'s, make sure you also escape the dash (-)
character manually.
preg_match("/^[A-Za-z\d" . preg_quote('!@#$%^&*()-_=+\|[]{};:/?.><',
'/') . "]{8,32}$/", $password)
The above will try to match the characters ')' through '_' whatever those are.
So use the below expression:
preg_match("/^[A-Za-z\d" . preg_quote('!@#$%^&*()_=+\|[]{};:/?.><',
'/') . "\-]{8,32}$/", $password)
Yes, I know I can use \w in place of A-Za-z, but I wanted to illustrate my point better :)