62,071
社区成员
发帖
与我相关
我的任务
分享
static void Main(string[] args)
{
Regex r = new Regex(@"<a[^>]*>|</a>$");
string result = r.Replace(@"请访问如下链接 <a hrdf='http://www.sohu.com'>sohu </a>", "");
Console.WriteLine(result);
}
Regex re = new Regex(@"<a\s+(?:(?!</a>).)*?>|</a>", RegexOptions.None);
string result = re.Replace(@"请访问如下链接 <a hrdf='http://www.sohu.com'>sohu </a>","");
Console.WriteLine(result);
/*
请访问如下链接 sohu
*/