Use <code>/(&lt;br\ ?\/?&gt;)+/</code> for the pattern to catch &lt;br&gt;, &lt;br/&gt; and &lt;br /&gt;.