Regex to match all HTML tags except

and

后端 未结 13 778
抹茶落季
抹茶落季 2020-11-30 06:31

I need to match and remove all tags using a regular expression in Perl. I have the following:

<\\\\??(?!p).+?>

But this still matche

13条回答
  •  盖世英雄少女心
    2020-11-30 07:20

    You should probably also remove any attributes on the

    tag, since someone bad could do something like:

    Clickable text

    The easiest way to do this, is to use the regex people suggest here to search for <p> tags with attributes, and replace them with

    tags without attributes. Just to be on the safe side.

提交回复
热议问题