编程语言

img iwebsms

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

发表于2004/10/31 20:55:00  1594人阅读

              string str="wecncnc<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<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(@"<a[^>]+href=""(?<url>[^""]+)""",RegexOptions.IgnoreCase);

 

              Match m = re.Match(str);

              if (m.Success)

                   Console.WriteLine(m.Groups["url"].Value);
阅读全文
0 0

相关文章推荐

img
取 消
img