1 protected void Page_Load(object sender, EventArgs e) 
{
string s = @"<a href=""http://www.qq.com"">腾讯</a> <a href=""http://www.163.com"">网易</a> <a href=""http://www.sina.com.cn"">新浪</a>";
MatchEvaluator me = new MatchEvaluator(ABC);
string r = Regex.Replace(s, @"(?is)<a[^>]*href=([""'])(?<href>.*?)\1>.*?</a>", me);
Response.Write(r); Response.End(); }

private string ABC(Match match)
{

if (!match.Groups["href"].Value.ToLower().Contains("www.sina.com.cn"))
return "";
else return match.Value;
}

相关文章:

  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2021-06-22
  • 2022-12-23
  • 2021-12-28
猜你喜欢
  • 2021-08-26
  • 2022-01-12
  • 2022-02-28
  • 2022-12-23
  • 2021-04-23
  • 2021-08-22
相关资源
相似解决方案