static void Main( string [] args)
{
Regex re = new Regex( @" (?<url>/bhttp://[^/u4e00-/u9fa5/s]*)|<a/s*href=""(?<url>[^""]*)""[^>]*> " );
string s = @" http://zhidao.baidu.com/question/102440411.html里面的还其它信息,包手 <A等...
http://zhidao.baidu.com/question/105773275.html
<a href=""/question/102440411.html"">新闻 </a>
<a href=""/question/102440412.html"">新闻 </a>
<a href=""/question/102440413.html"">新闻 </a>
<a href=""/question/102440414.html"">新闻 </a> " ;
Match m;
for (m = re.Match(s); m.Success; m = m.NextMatch())
{
Console.WriteLine(m.Groups[ " url " ].ToString());
}
}
提取文本中的超链接(转自csdn问题。由LCL_data兄解答)
最新推荐文章于 2019-01-02 10:54:15 发布