regex - How to remove this empty <p><span>&nbsp;</span></p> tag using regular expression and php -


i have requirement need remove piece of text.

<p><span>&nbsp;</span></p> 

for example

<p><span>because coffee grinds stay in pod there virtually no cleaning either.</span></p> <p><span>&nbsp;</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>&nbsp;</span></p> 

if need remove piece of code, don't need regex @ all. simple replace, using str_replace

$string = str_replace("<p><span>&nbsp;</span></p>", "", $string); 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -