note 43371 added to function.preg-replace

From: Date: Sat, 19 Jun 2004 00:11:56 +0000
Subject: note 43371 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-71308@lists.php.net to get a copy of this message
Just to add another "don't-do-this-unless-you-want-a-headache" note... I started with preg_replace a little bit ago and the numbers in the second arguement of the function was confusing me. For example... <?php preg_replace("|\[div](.+)\[/div]|ise", "<div class='whatever'>\\1</div>", $string); ?> "\\1" is the first parenthysised (I can never spell that word...) group, in this case whatever is inside the [div][/div] tags, or .+ in this example. For some reason, "\$1" doesn't work with me. ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43371 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43371&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43371&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71308) next »