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

求教,php写正则匹配html代码的数据
我想要获得 【学生图书】 的名字,图书的href URL地址,图书的图片地址,销售量,售价,市场价,怎么写正则匹配呢,我写的正则老是出问题?匹配不到数据

html代码
<div class="detail">
<div><a href="http://a.m.tmall.com/i19614323487.htm?sid=b7a1bfbd834f7a71">学生图书一xxxx</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="pic border" style="width:100px;height:100px;text-align:center;vertical-align:middle;">
<a href="http://a.m.tmall.com/i19614323487.htm?sid=b7a1bfbd834f7a71">
<img src="http://q.i01.wimg.taobao.com/bao/uploaded/i2/19264023005683587/T1Fs0MXqleXXXXXXXX_!!0-item_pic.jpg_100x100.jpg" alt="学生图书一" />
</a></td>
<td valign="middle">
<p>
售出:336笔<br/>
<span class="red">¥139.00</span><br />
<del class="gray" style="text-decoration:line-through;">¥239.00</del>

                    </p>
</td>
</tr>
</table>
<!--    139.00  -->
</div>
</div>
<hr/>
   
<!--catid=50010850, catPath= -->
                    <div class="box">
<div class="detail">
<div><a href="http://a.m.tmall.com/i23681020274.htm?sid=b7a1bfbd834f7a71">学生图书二</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="pic border" style="width:100px;height:100px;text-align:center;vertical-align:middle;">
<a href="http://a.m.tmall.com/i23681020274.htm?sid=b7a1bfbd834f7a71">
<img src="http://q.i04.wimg.taobao.com/bao/uploaded/i2/19264021080891188/T1abNLXu8fXXXXXXXX_!!0-item_pic.jpg_100x100.jpg" alt="学生图书二" />
</a></td>
<td valign="middle">
<p>
售出:266笔<br/>
<span class="red">¥189.03</span><br />
<del class="gray" style="text-decoration:line-through;">¥339.00</del>

                    </p>
</td>
</tr>
</table>
<!--    189.03  -->
</div>
</div>
<hr/>
   
<!--catid=50010850, catPath= -->
                    <div class="box">
<div class="detail">
<div><a href="http://a.m.tmall.com/i17747874821.htm?sid=b7a1bfbd834f7a71">学生图书三</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="pic border" style="width:100px;height:100px;text-align:center;vertical-align:middle;">
<a href="http://a.m.tmall.com/i17747874821.htm?sid=b7a1bfbd834f7a71">
<img src="http://q.i03.wimg.taobao.com/bao/uploaded/i1/19264021076909972/T1zZBNXr8bXXXXXXXX_!!0-item_pic.jpg_100x100.jpg" alt="三" />
</a></td>
<td valign="middle">
<p>
售出:120笔<br/>
<span class="red">¥239.04</span><br />
<del class="gray" style="text-decoration:line-through;">¥398.00</de