请问这个用正则如何匹配?
目的是匹配网页源代码中的href,大概有三种类型
类型一:
---换行---
---换行---
一一一一(seo)
类型二:
[引蜘蛛]onclick="atarget(this)" class="xst" >二二二二
类型三:
三三三
自己写了个$pattern = "/".preg_quote('
','/').".+".preg_quote('class="xst" >','/').'/i';
但是不能完全匹配。。求高手帮忙
我说下我的思路先:
以
------解决方案--------------------
- PHP code
$str=<<<html<th class="new"><a href="http://bbs.111.com/thread-11.html" onclick="atarget(this)" class="xst" >一一一一(seo)</a>类型二:<th class="common"> <em>[<a href="http://www.444.com/forum.php?">引蜘蛛</a>]</em><a href="http://www.444.com/thread-263.html" onclick="atarget(this)" class="xst" >二二二二</a>类型三:<th class="common"> <a href="http://www.555.com/thread-161.html" style="color: #EC1282" class="xst" target="_blank" >三三三</a> <th class="aa"> <a href="http://www.555.com/thread-161.html" style="color: #EC1282" class="xst" target="_blank" >三三三</a>html;preg_match_all('/(?:<th class="new|common">).+<a href="([^"]+)"\s*(?:onclick|style).+/isU',$str,$arr);print_r($arr[1]);<div class="clear">
</div>









