and
I need to match and remove all tags using a regular expression in Perl. I have the following:
<\\\\??(?!p).+?>
But this still matche
Not sure why you are wanting to do this - regex for HTML sanitisation isn't always the best method (you need to remember to sanitise attributes and such, remove javascript: hrefs and the likes)... but, a regex to match HTML tags that aren't :
(<[^pP].*?>|[^pP]>)
Verbose:
(
< # < opening tag
[^pP].*? # p non-p character, then non-greedy anything
> # > closing tag
| # ....or....
#
[^pP] # a non-p tag
> # >
)