使用 preg_replace 删除整个嵌套


Removing whole nested <div> using preg_replace

我需要用preg_replace删除一个整体。不幸的是,我不能在这里使用任何PHP Dom设施作为未经我编码的脚本的一部分

<div class="box" id="idxFeach" style="">
<h2 class="gr"><div hint="Refresh" onclick="xEvent.frameLoad('#popularBox','/viewFrame.php?'+Math.random()); return false;" class="icon iconRefresh"></div>Featured</h2>
<div class="boxC">
<iframe frameborder="no" align="middle" scrolling="no" src="/viewFrame.php?1381845110781" allowtransparency="true" marginheight="0" marginwidth="0" id="popularBox"></iframe>
<div class="loader" style="display: none;"></div>
</div>
</div>

我需要删除整个

<div class="box" id="idxFeach" style=""> .. </div>

谢谢吨

preg_replace使用生成有限自动机的正则表达式引擎,因此无法搜索通用嵌套表达式。 更多在这里:

正则表达式可以用来匹配嵌套模式吗?