php - preg_replace with a div and dynamic id attribute -
i have div container wanted delete coding. div has id dynamic number.
the div this:
< div id="my-message-52617" class="label"> data inside div < /div>
how can using preg_replace
?
i used this:
preg_replace("# < div id=\"my-message- ( . * ? ) \" class=\"label\">([^`]*?) < /div>#", "", $data);
but seems doesn't work @ all.
i need correct pattern replace data.
it's not working... anyway bro...
i have better solution friend of mine now. , it's working fine:
preg_replace('/< div.?id="my-message-[\s\s]? < /div>/i', '', '< div id="my-message-52617" class="label">all data inside div< /div>');
Comments
Post a Comment