Revision: 58128
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 27, 2012 08:18 by pumpkinthehead
Initial Code
$output = preg_replace('/<(((?!br)[^>])*)>\r*\n*\s*(<br\s?\/?>)*\r*\n*\s*<(((?!br)[^>])*)>/i', '<$1><$4>', $output);
Initial URL
Initial Description
A regular expression for removing <br> and <br> (case insensitive) between HTML elements if there is no content between the HTML elements. It was written for fixing extra line spaces created in a WordPress visual editor after the content of the visual editor was returned from the PHP nl2br() method.
Initial Title
Remove superfluous line breaks between HTML elements.
Initial Tags
regex, php, wordpress
Initial Language
PHP