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,""

 

posted @ 2020-11-03 16:06  netlock  阅读(656)  评论(0)    收藏  举报