日期:2014-05-17  浏览次数:20452 次

求一正则表达式,匹配一个限定的id
<table id="forum_list" cellspacing="0" style="width:760px;">  匹配这个id!
------最佳解决方案--------------------
$s='你的串';
preg_match('/<table id="forum_list"[^>]*>(.*?)<\/table>/s',$s,$m);
echo $m[1]; 
------其他解决方案--------------------
/ id="([^"]*)"/
------其他解决方案--------------------
引用:
/ id="([^"]*)"/
  匹配forum_list这个固定ID
------其他解决方案--------------------
引用:
/ id="([^"]*)"/
匹配forum_list这个固定ID 以及下面的所有内容!
------其他解决方案--------------------
那个id看上去像discuz的
------其他解决方案--------------------
如果是匹配大堆html内容,最好把内容装载进dom,用dom的方式处理dom