Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
<(?!\/*strong\W|\/*h1\W|\/*input\W|\/*b\W).*?>
/
gm

Description

Find all html-tags except for some that you want to preserve for any reason. I use this to remove all tags except those I want to keep.

Submitted by anonymous - 6 years ago