Regex to match all HTML tags except <p> and </p>

Posted by Xetius on Stack Overflow See other posts from Stack Overflow or by Xetius
Published on 2008-08-27T10:41:44Z Indexed on 2010/05/28 10:22 UTC
Read the original article Hit count: 207

Filed under:
|
|

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

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

But this still matches with the closing </p> tag. Any hint on how to match with the closing tag as well?

Note, this is being performed on xhtml.

© Stack Overflow or respective owner

Related posts about html

Related posts about regex