js正则表达式清除指定标签外所有标签

隔壁家的老王头 / 2023-05-05 / 原文

除了strong、em、p标签,其他标签全部清除:

str = str.replace(/<(?!\/?strong|\/?em|\/?p)[^<>]*>/ig,'')