日期:2014-05-17 浏览次数:20500 次
$str = "<div class='a'><div>cc</div>a<span>ab</span>c<div class='b'>xxxy</div></div>"; preg_match_all("#((?'open'<div[^>]*>)((?:.(?!</?div))*.)*?)((?'-open'</div[^>]*>)((?:.(?!</?div))*.)*?)#is",$str,$matches); print_r($matches);