note 51516 added to function.preg-replace

From: Date: Sat, 02 Apr 2005 10:49:44 +0000
Subject: note 51516 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-87339@lists.php.net to get a copy of this message
It is of notice that, while it is not mentioned in the manual, preg_replace also accepts back-references in the pattern. So, something like: print preg_replace("/<([a-z0-9]*)>.*<\/\\1>/","-REPLACED-","blah <mytag>text text</mytag> test <xxx>yadda yadda yadda</xxx> <xy>nope</ab>"); results in: blah -REPLACED- test -REPLACED- <xy>nope</ab> ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51516 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51516&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51516&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51516&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51516&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51516&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51516&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#87339) next »