php - preg_replace div (or anything) with class=removeMe -


just trying remove elements preg_replace can't work consistently. remove element matching class. problem element may have id or several classes.

ie element be

<div id="me1" class="removeme">remove me , parent</div>  

or

<div id="me1" class="removeme" style="display:none">remove me , parent</div> 

is possible this?

any appreciated! dan.

while still doable regular expression, it's simpler e.g. querypath:

print qp($html)->find(".removeme")->parent()->remove()->writehtml(); 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -