note 103985 added to function.preg-replace
| From: | craiga at craiga dot id dot au | Date: | Mon, 16 May 2011 02:02:41 +0000 |
| Subject: | note 103985 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-179742@lists.php.net to get a copy of this message | ||
If there's a chance your replacement text contains any strings such as "$0.95",
you'll need to escape those $n backreferences:
<?php
function escape_backreference($x)
{
return preg_replace('/\$(\d)/', '\\\$$1', $x);
}
?>
----
Server IP: 117.55.229.1
Probable Submitter: 203.206.182.17
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/103985
Del: integrated -- https://master.php.net/note/delete/103985/integrated
Del: useless -- https://master.php.net/note/delete/103985/useless
Del: bad code -- https://master.php.net/note/delete/103985/bad+code
Del: spam -- https://master.php.net/note/delete/103985/spam
Del: non-english -- https://master.php.net/note/delete/103985/non-english
Del: in docs -- https://master.php.net/note/delete/103985/in+docs
Del: other reasons-- https://master.php.net/note/delete/103985
Reject -- https://master.php.net/note/reject/103985
Search -- https://master.php.net/manage/user-notes.php