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
Post a Comment