note 41809 added to function.quotemeta
| From: | runesk at linpro dot no | Date: | Thu, 22 Apr 2004 16:52:36 +0000 |
| Subject: | note 41809 added to function.quotemeta | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68539@lists.php.net to get a copy of this message | ||
As this do not escapes |, you should be careful using a quotemeta'ed string as a valid regexp
pattern. I ran into such a hole just now, and ended up using this code:
<?php
$pattern = preg_replace("/\|/", "\\|", quote_meta($pattern);
?>
----
Manual Page -- http://www.php.net/manual/en/function.quotemeta.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41809
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41809&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41809&report=yes
Search -- http://master.php.net/manage/user-notes.php