<tr><td style="text-align: center;" bgcolor="#ebe9e4" height="24">12000元</td>        </tr>        <tr bgcolor="#ebe9e4">            <td colspan="4" height="24">            <div style="text-align: right;"><span style="color: rgb(0, 0, 0);">信息采集;09-11-13 制表:</span><a target="_blank" href="http://www.xxx.com.cn/"><span style="color: rgb(0, 0, 0);">某某</span></a><span style="color: rgb(0, 0, 0);">汽车网&nbsp;&nbsp; </span><a href="http://www.xxx.com.cn/"><span style="color: rgb(0, 0, 0);">http://www.xxx.com.cn</span></a></div>            </td>        </tr>
以上是原始字符传.我想把带有采集 那个tr 一整行给替换为空.测试很多次没解决.所以在这里来发帖子了.求达人帮忙解决下.

解决方案 »

  1.   


    $str=preg_replace('/<tr .*?>.*?信息采集.*?<\/tr>/','',$str);
    echo $str;
      

  2.   

         <tr><td style="text-align: center;" bgcolor="#ebe9e4" height="24">12000元</td> </tr> <tr bgcolor="#ebe9e4"> <td colspan="4" height="24"> <div style="text-align: right;"><span style="color: rgb(0, 0, 0);">信息采集;09-11-13 制表:</span><a target="_blank" href="http://www.xxx.com.cn/"><span style="color: rgb(0, 0, 0);">某某</span></a><span style="color: rgb(0, 0, 0);">汽车网&nbsp;&nbsp; </span><a href="http://www.xxx.com.cn/"><span style="color: rgb(0, 0, 0);">http://www.xxx.com.cn</span></a></div> </td> </tr><tr><td style="text-align: center;" bgcolor="#ebe9e4" height="24">某某</td>
    就是把中间那个tr 去掉
     结果变成
    <tr><td style="text-align: center;" bgcolor="#ebe9e4" height="24">12000元</td> </tr> <tr><td style="text-align: center;" bgcolor="#ebe9e4" height="24">某某</td>
      

  3.   

    <tr .*?> .这个符号为啥有个空格啊.如果能讲讲就更好了.不用 . 这个符号之前那个空格就匹配不到了.