Remove html tags except
or
tags with javascript

后端 未结 5 1995
渐次进展
渐次进展 2020-12-03 03:09

I want to remove all the html tags except
or
tags from a string using javascript. I have seen many questions like this but t

5条回答
  •  醉酒成梦
    2020-12-03 04:05

    To expand h2ooooooo Answer to include leading spaces and be case insenctive you could use

    /<(?!\s*br\s*\/?)[^>]+>/gi
    

提交回复
热议问题