note 38519 added to function.preg-quote
| From: | mina86 at tlen dot pl | Date: | Thu, 25 Dec 2003 20:02:55 +0000 |
| Subject: | note 38519 added to function.preg-quote | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62454@lists.php.net to get a copy of this message | ||
Re: adrian holovaty
You must also escape '#' character. Next thing is that there is more then one whitespace
character (a space).. Also IMO the name preg_quote_white() won't tell what the new function
does so we could rename it. And finally, we should also add $delimiter:
<?php
function preg_xquote($a, $delimiter = null) {
if ($delimiter) {
return preg_replace('/[\s#]/', '\\\0', preg_quote($a,
substr("$delimiter", 0, 1)));
} else {
return preg_replace('/[\s#]/', '\\\0', preg_quote($a));
}
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.preg-quote.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38519
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38519&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38519&report=yes
Search -- http://master.php.net/manage/user-notes.php