note 51545 added to function.preg-replace

From: Date: Sun, 03 Apr 2005 14:16:01 +0000
Subject: note 51545 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-87401@lists.php.net to get a copy of this message
if you have an unknown text as a replace string and you don't want any occurences of $ followed by a number act as a backreference make sure that all $ characters are escaped. Otherwise your resulting string will be shorter when your searchstring doesn't contain any subpattern example: <?php // $replace defined elsewhere as $replace = "costs $1.00"; preg_replace("/findthis:.*?\n/", $replace, $text); ?> ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51545 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51545&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51545&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51545&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51545&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51545&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51545&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#87401) next »