用这个正则
<a href="(?<urlText>[^"]*)"
分组urlText就是你要的href的内容MatchCollection Matchs = Regex.Matches(strResponse, "<a href=\"(?<urlText>[^\"]*)\"
", RegexOptions.IgnoreCase);
foreach(Match NextMatch in Matchs)
{
string contectUrl= NextMatch.Group[urlText].Value;//你要的
string wholeSearchedString = NextMatch.Value;//全部,不知道你要这么多干嘛,
}
foreach(Match NextMatch in Matchs)
{
string contectUrl= NextMatch.Value;//你要的
}
----------------------------
这个正则我试过了,不行呢。用两次正则可以捕捉到
先用
<a href=[\w\W]*?>
然后再用
(?<=href=)[\w\W]*?(?=target)
<div class="feedback_phone" >
<a href="http://betterhot.cn.alibaba.com/athena/contact/betterhot.html?contactFrom=sellofferlist_contact&keywords=热水器" target="_blank" onclick="clickAddParam(this, false, 'ContactInfoClick_companylist_tp ')" >
这样
可以用这个正则:
<div[\w\W]*?>[\s]*?<a href=[\w\W]*?>
可以捕捉到再用正则提取,然后再用我上面写的正则。
要多次运用正则
期待更佳答案~~~~~~~