note 71536 added to function.preg-quote
| From: | chad at osu1 dot php dot net | Date: | Mon, 04 Dec 2006 22:03:15 +0000 |
| Subject: | note 71536 added to function.preg-quote | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120282@lists.php.net to get a copy of this message | ||
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 :)
----
Server IP: 216.194.113.175
Probable Submitter: 216.130.23.249
----
Manual Page -- http://www.php.net/manual/en/function.preg-quote.php
Edit -- https://master.php.net/note/edit/71536
Del: integrated -- https://master.php.net/note/delete/71536/integrated
Del: useless -- https://master.php.net/note/delete/71536/useless
Del: bad code -- https://master.php.net/note/delete/71536/bad+code
Del: spam -- https://master.php.net/note/delete/71536/spam
Del: non-english -- https://master.php.net/note/delete/71536/non-english
Del: in docs -- https://master.php.net/note/delete/71536/in+docs
Del: other reasons-- https://master.php.net/note/delete/71536
Reject -- https://master.php.net/note/reject/71536
Search -- https://master.php.net/manage/user-notes.php