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

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

xcode - Swift Playground - Files are not readable -

jboss7.x - JBoss AS 7.3 vs 7.4 and differences -