Regex to match all HTML tags except

and

后端 未结 13 771
抹茶落季
抹茶落季 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:09

    I used Xetius regex and it works fine. Except for some flex generated tags which can be :
    with no spaces inside. I tried ti fix it with a simple ? after \s and it looks like it's working :

    <(?!\/?p(?=>|\s?.*>))\/?.*?>
    

    I'm using it to clear tags from flex generated html text so i also added more excepted tags :

    <(?!\/?(p|a|b|i|u|br)(?=>|\s?.*>))\/?.*?>
    

提交回复
热议问题