Is there a way in PHP to remove all divs with a specific class from a content and return a result, for example I have this code :
<?php
$content = '<div class="toRemove">
content here
bla bla
<div class="toBeRemoved">content here also</div>
<div class="test">content ...</div>
lorem ipsum dolor sit ...
other divs here with different classes and ids
</div>
<div class="otherInfo">....</div>
';
$content = preg_replace('#<div class="toRemove">([\s\S]*?)</div>#','', $content); // tried this but did work as I wanted to
echo $content;
What I want is to remove all content inside div with class toRemove, what I get is a content where child divs not removed !
Thanks in advance for ur help.