note 20948 deleted from function.preg-replace by sniper

From: Date: Fri, 17 Oct 2003 03:53:29 +0000
Subject: note 20948 deleted from function.preg-replace by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-58736@lists.php.net to get a copy of this message
Note Submitter: tom@squeat.com ---- 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);

« previous php.notes (#58736) next »