Link to home
Create AccountLog in
Avatar of Nikolaous
Nikolaous

asked on

Regex: how to remove all empty html tags (including tags which contain colons)

So I know the following regex pattern will remove all empty html tags that just contain letters and numbers like  <div></div> <p></p> <abc></abc> <123></123>

<(\w+)>(\s|&nbsp;)*</\1>

What I would like to do is also remove html tags that have special characters (specifically a colon) that come from applications like MS Office.  So remove tags that are in the form of <o:p></o:p>
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer