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;
}