I want <br /><br /> to turn into <br />
<br /><br />
<br />
What's the pattern for this with regex?
Note: The <br /> tags can occur more than 2 times in a row.
$html = preg_replace('#(<br */?>s*)+#i', '<br />', $html);
This will catch any combination of <br>, <br/>, or <br /> with any amount or type of whitespace between them and replace them with a single <br />.
<br>
<br/>
1.4m articles
1.4m replys
5 comments
57.0k users