regex - How to remove this empty <p><span> </span></p> tag using regular expression and php -
i have requirement need remove piece of text.
<p><span> </span></p>
for example
<p><span>because coffee grinds stay in pod there virtually no cleaning either.</span></p> <p><span> </span></p> <p><span>hey presto, coffee, way every time. </span></p>.
i have tried to remove empty
<p></p>
using regular expression
$pattern1 = "/<p[^>]*><\\/p[^>]*>/";
how should modify remove empty tag
<p><span> </span></p>
if need remove piece of code, don't need regex @ all. simple replace, using str_replace
$string = str_replace("<p><span> </span></p>", "", $string);
Comments
Post a Comment