一段找出URL的代码(C#)

string str="wecncnc

1<a href='\"list.asp?Page=1&amp;boardid=33&amp;t=656727&amp;p=11&amp;tp=%B9%AB%BF%AAICSI%B5%C4MP3%B7%BD%B0%B8%C9%E8%BC%C6\"'>下一页</a>

";

str+="wecncnc

1<a href='\"listww.asp?Page=1&amp;boardid=33&amp;t=656727&amp;p=11&amp;tp=%B9%AB%BF%AAICSI%B5%C4MP3%B7%BD%B0%B8%C9%E8%BC%C6\"'>下一页</a>

";

Regex re = new Regex(@"

1<a[^>]+href=""(?<url>[^""]+)""",RegexOptions.IgnoreCase); 
2
3Match m = re.Match(str); 
4
5if  (m.Success) 
6
7Console.WriteLine(m.Groups["url"].Value);</url></a[^>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus