note 51516 deleted from function.preg-replace by tularis
| From: | tularis@php.net | Date: | Sun, 18 Jun 2006 13:25:35 +0000 |
| Subject: | note 51516 deleted from function.preg-replace by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-114310@lists.php.net to get a copy of this message | ||
Note Submitter: patola obfuscated-at gmail.com
----
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>