Chinaunix
标题:
greed/nogreed 不管怎样都不完美。。。
[打印本页]
作者:
pooronce
时间:
2009-08-23 03:18
标题:
greed/nogreed 不管怎样都不完美。。。
发现不管用贪婪还是非贪婪,都不好进行多段匹配,似乎当非贪婪时,它住住结束判断过早
比如:
@row = $string =~ m@id="row1".*?site="(.*?)".*?title="(.*?).*?id="row2".*?site="(.*?)".*?title="(.*?).*?id="row3".*?site="(.*?)".*?title="(.*?).*?id="row4".*?site="(.*?)".*?title="(.*?).*?id="row5".*?site="(.*?)".*?title="(.*?)"@ism;
复制代码
用这个去匹配这段代码:
Referring Site's Destination Share to pandabuy.com
<img class="popup-help q99" src="http://media.compete.com/site_media/images/icons/helpicon.png" height="13" width="13" />
</span>
</th>
</tr>
</thead>
<tbody>
<tr class="white" id="row1" onmouseover="highlightRow(1);" onmouseout="unhighlightRow(1);">
<td style="width: 58px;" >1</td>
<td class="left">
<a class="tmp sitelink" site="google.com" href="/referral/google.com" >google.com</a>
</td>
<td title="38.3260903%">
<div class="percent">38.33%</div>
<div class="bargraph">
<div class="colorbar" style="width:38%"></div>
</div>
</td>
<td title="39.82">
<span id="ref_growth">
39.82
</span>
% <img src="http://media.compete.com/site_media/images/arrow_up.gif" />
</td>
<td title="0.0000298%">
<div class="percent">
<a href="/destination/google.com">< 0.01%</a>
</div>
<div class="bargraph">
<div class="colorbar" style="width:0%"></div>
</div>
</td>
</tr>
<tr class="grey" id="row2" onmouseover="highlightRow(2);" onmouseout="unhighlightRow(2);">
<td style="width: 58px;" >2</td>
<td class="left">
<a class="tmp sitelink" site="univision.com" href="/referral/univision.com" >univision.com</a>
</td>
<td title="6.7036345%">
<div class="percent">6.7%</div>
<div class="bargraph">
<div class="colorbar" style="width:7%"></div>
</div>
</td>
<td title="First month of referral data for Referring Site">
<span id="ref_growth">
New
</span>
</td>
<td title="0.0050100%">
<div class="percent">
<a href="/destination/univision.com">0.01%</a>
</div>
<div class="bargraph">
<div class="colorbar" style="width:0%"></div>
</div>
</td>
</tr>
<tr class="white" id="row3" onmouseover="highlightRow(3);" onmouseout="unhighlightRow(3);">
<td style="width: 58px;" >3</td>
<td class="left">
<a class="tmp sitelink" site="amazon.com" href="/referral/amazon.com" >amazon.com</a>
</td>
<td title="4.6109130%">
<div class="percent">4.61%</div>
<div class="bargraph">
<div class="colorbar" style="width:5%"></div>
</div>
</td>
<td title="First month of referral data for Referring Site">
<span id="ref_growth">
New
</span>
</td>
<td title="0.0000901%">
<div class="percent">
<a href="/destination/amazon.com">< 0.01%</a>
</div>
<div class="bargraph">
<div class="colorbar" style="width:0%"></div>
</div>
</td>
</tr>
<tr class="grey" id="row4" onmouseover="highlightRow(4);" onmouseout="unhighlightRow(4);">
<td style="width: 58px;" >4</td>
<td class="left">
<a class="tmp sitelink" site="163.com" href="/referral/163.com" >163.com</a>
</td>
<td title="Sample size too small to show values">
Low Sample
</td>
<td title="Sample size too small to show a change in share value">
<span id="ref_growth">
-
</span>
</td>
<td title="Sample size too small to show values">
<a href="/destination/163.com">
Low Sample
</a>
</td>
</tr>
<tr class="white" id="row5" onmouseover="highlightRow(5);" onmouseout="unhighlightRow(5);">
<td style="width: 58px;" >5</td>
<td class="left">
<a class="tmp sitelink" site="amazon.co.jp" href="/referral/amazon.co.jp" >amazon.co.jp</a>
</td>
<td title="Sample size too small to show values">
Low Sample
</td>
<td title="Sample size too small to show a change in share value">
<span id="ref_growth">
-
</span>
</td>
<td title="Sample size too small to show values">
<a href="/destination/amazon.co.jp">
Low Sample
</a>
</td>
</tr>
</tbody>
复制代码
就会漏取掉其中的东西。。。
作者:
blackold
时间:
2009-08-23 11:30
标题:
回复 #1 pooronce 的帖子
世上本无完美。
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2