This should be fairly simple for someone who does this sort of thing more often than I...
I'm working with text output by TinyMCE, which sometimes seems to add extra empty paragraphs at the end of text - either:
<p></p>
or
<p> </p>
Sometimes there are multiple empties at the end:
<p> </p>
<p> </p>
<p> </p>
I'm trying to write an expression to nuke them in a batch, but it only seems to slice off one at a time. Here's what I have so far:
$value = preg_replace("/(<p>( )?<\/p>\s?)+$/", '', $value);
I also tried it with the whitespace character at the beginning:
$value = preg_replace("/(\s?<p>( )?<\/p>)+$/", '', $value);
What am I doing wrong, so that this is only removing one offending paragraph at a time?