string s = "提取网页中的超链接的link和text部分~提取网页中的超链接的link和text部分~提取网页中的超链接的link和text部分~..";   
Regex re 
= new Regex(@"<a[^>]*href=(""(?<href>[^""]*)""|'(?<href>[^']*)'|(?<href>[^\s>]*))[^>]*>(?<text>.*?)</a>", RegexOptions.IgnoreCase | RegexOptions.Singleline);   
Match m  
= re.Match(s);   
if(m.Success)   
{   
  
string link = m.Groups["href"].Value;   
  
string text = Regex.Replace(m.Groups["text"].Value,"<[^>]*>","");   
  Console.WriteLine(
"link:{0}\ntext:{1}", link, text);   
}

相关文章:

  • 2022-02-07
  • 2022-02-07
  • 2022-02-07
  • 2022-02-07
  • 2022-02-07
  • 2021-10-19
  • 2022-02-07
  • 2022-12-23
猜你喜欢
  • 2022-02-07
  • 2021-06-02
  • 2021-06-18
  • 2022-02-12
  • 2022-12-23
相关资源
相似解决方案