JS C# 正则表达式去除html字符中所有的标签(img em标签除外)

js去除em标签

$(this).html().replace(/<(?!em|/em).*?>/g, '')

C#去除

System.Text.RegularExpressions.Regex.Replace(hit.Source.Content.HtmlDecode(), "<(?!em|/em).*?>", "");

多个就是

/<(?!img).*?>/g, ""
/<(?!img|p|/p).*?>/g,""
原文地址:https://www.cnblogs.com/netlock/p/13920832.html