Regular Expressions 101

Community Patterns

Strip / Delete / Remove / empty paragraphs

1

Regular Expression
PCRE (PHP <7.3)

/
<p>(\s|&nbsp;|<\/?\s?br\s?\/?>)*<\/?p>
/
gi

Description

You can format p:empty paragraphs with CSS, but sometimes they are not completely empty. This is meant to remove those.

Submitted by SocialBlogsiteWebDesign.com - 9 years ago