<div class="quote" style=""><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td width="24%"> <a href="http://www.xx.com.cn/qbs/shop_4150.html"><img src="http://www.xx.com.cn/images/upfiles/qbs/20090624153330.jpg" bgcolor="eaeaea" height="120" width="120"></a> </td>
<td style="padding-top: 15px;" valign="top" width="76%"><a href="http://www.xx.com.cn/qbs/shop_4150.html">
<span style="font-size: 12px; color: rgb(102, 102, 102); font-weight: 100;">商家口碑: </span></td>
</tr>
</tbody></table></div><br>sss[attachimg]1213208[/attachimg][attachimg]1213208[/attachimg][attachimg]1213208[/attachimg]<br>************************<div></div>
得到有颜色的部分
<tbody><tr>
<td width="24%"> <a href="http://www.xx.com.cn/qbs/shop_4150.html"><img src="http://www.xx.com.cn/images/upfiles/qbs/20090624153330.jpg" bgcolor="eaeaea" height="120" width="120"></a> </td>
<td style="padding-top: 15px;" valign="top" width="76%"><a href="http://www.xx.com.cn/qbs/shop_4150.html">
<span style="font-size: 12px; color: rgb(102, 102, 102); font-weight: 100;">商家口碑: </span></td>
</tr>
</tbody></table></div><br>sss[attachimg]1213208[/attachimg][attachimg]1213208[/attachimg][attachimg]1213208[/attachimg]<br>************************<div></div>
得到有颜色的部分
preg_match_all("/^(.*?)(?=<br>)/",$str,$out);
echo $out[1][0];
$str =<<<html
<div class="quote" style=""> <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody> <tr>
<td width="24%"> <a href="http://www.xx.com.cn/qbs/shop_4150.html"> <img src="http://www.xx.com.cn/images/upfiles/qbs/20090624153330.jpg" bgcolor="eaeaea" height="120" width="120"> </a> </td>
<td style="padding-top: 15px;" valign="top" width="76%"> <a href="http://www.xx.com.cn/qbs/shop_4150.html">
<span style="font-size: 12px; color: rgb(102, 102, 102); font-weight: 100;">商家口碑: </span> </td>
</tr>
</tbody> </table> </div> <br>sss[attachimg]1213208[/attachimg][attachimg]1213208[/attachimg][attachimg]1213208[/attachimg] <br>************************ <div> </div>
html;
preg_match_all("/^(.+?)(<br>)/s",$str,$out);
echo $out[1][0];
<div class="quote" style=""> <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody> <tr>
<td width="24%"> <a href="http://www.xx.com.cn/qbs/shop_4150.html"> <img src="http://www.xx.com.cn/images/upfiles/qbs/20090624153330.jpg" bgcolor="eaeaea" height="120" width="120"> </a> </td>
<td style="padding-top: 15px;" valign="top" width="76%"> <a href="http://www.xx.com.cn/qbs/shop_4150.html">
<span style="font-size: 12px; color: rgb(102, 102, 102); font-weight: 100;">商家口碑: </span> </td>
</tr>
</tbody> </table> </div> <br>sss[attachimg]1213208[/attachimg][attachimg]1213208[/attachimg][attachimg]1213208[/attachimg] <br>************************ <div> </div>
<div class="quote" style=""> <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody> <tr>
<td width="24%"> <a href="http://www.xx.com.cn/qbs/shop_4150.html"> <img src="http://www.xx.com.cn/images/upfiles/qbs/20090624153330.jpg" bgcolor="eaeaea" height="120" width="120"> </a> </td>
<td style="padding-top: 15px;" valign="top" width="76%"> <a href="http://www.xx.com.cn/qbs/shop_4150.html">
<span style="font-size: 12px; color: rgb(102, 102, 102); font-weight: 100;">商家口碑: </span> </td>
</tr>
</tbody> </table> </div> <br>sss[attachimg]1213208[/attachimg][attachimg]1213208[/attachimg][attachimg]1213208[/attachimg] <br>************************ <div> </div>
<div class="quote" style=""> <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody> <tr>
<td width="24%"> <a href="http://www.xx.com.cn/qbs/shop_4150.html"> <img src="http://www.xx.com.cn/images/upfiles/qbs/20090624153330.jpg" bgcolor="eaeaea" height="120" width="120"> </a> </td>
<td style="padding-top: 15px;" valign="top" width="76%"> <a href="http://www.xx.com.cn/qbs/shop_4150.html">
<span style="font-size: 12px; color: rgb(102, 102, 102); font-weight: 100;">商家口碑: </span> </td>
</tr>
</tbody> </table> </div> <br>sss[attachimg]1213208[/attachimg][attachimg]1213208[/attachimg][attachimg]1213208[/attachimg] <br>************************ <div> </div>
HTML;echo htmlspecialchars($str);echo '<hr>';preg_match_all('/(<div[^<]*?)(<table[^`]*?table>)([^>]*?div>)/i' , $str , $ary);echo '<pre>';print_r($ary);echo "</pre>";?>