Wanted to convert
into
Use a regular expression to match <br/>
one or more times, then use preg_replace (or similar) to replace with <br/>
such as levik's reply.
Thanks all.. Used Jakemcgraw's (+1) version
Just added the case insensative option..
{(<br[^>]*>\s*)+}i
Great tool to test those Regular expressions is:
http://www.spaweditor.com/scripts/regex/index.php
Enhanced readability, shorter, produces correct output regardless of attributes:
preg_replace('{(<br[^>]*>\s*)+}', '<br/>', $input);