note 20948 added to function.preg-replace
| From: | tom at squeat dot com | Date: | Tue, 23 Apr 2002 03:52:05 +0000 |
| Subject: | note 20948 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29713@lists.php.net to get a copy of this message | ||
Have you ever wanted to remove the '<br />' tags between '<pre>' and
'</pre>' tags after a call to nl2br()? I just figured out how to do this and
thought others would benefit.
$html = preg_replace(
"/(<pre>)([\w\W]*)(<\/pre>)/e",
"'\\1'.str_replace('<br
/>','','\\2').'\\3'",
$html);
--
http://www.php.net/manual/en/function.preg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+20948
http://master.php.net/manage/user-notes.php?action=delete+20948
http://master.php.net/manage/user-notes.php?action=reject+20948