How can I remove <br/>
if no text comes before or after it?
For instance,
<p><br/>hello</p>
<p>hello<br/></p>
they should be rewritten like this,
<p>hello</p>
<p>hello</p>
Should I use DOMxpath or regex would be better?
(Note: I have a post about removing <p><br/></p>
with DOMxpath earlier, and then I came across this issue!)
EDIT:
If I have this in the input,
$content = '<p><br/>hello<br/>hello<br/></p>';
then it should be
<p>hello<br/>hello</p>'
hello
`? You want to remove the `world
` in that case? – netcoder Jul 27 '11 at 13:03
`. – Emiliano Poggi Jul 27 '11 at 13:16
`... and I use `pre_replace` to solve this situation - `$content = preg_replace('/(
\s*)+/', '
', $content);` – Run Jul 27 '11 at 13:39