Regular Expressions 101

Community Patterns

Match empty tags pair

1

Regular Expression
PCRE (PHP <7.3)

/
(?:<(\w+)>\s+<\/\1>\s+)+
/

Description

to find empty (or fill with space) tags pair ex matching : <test></test> <xxx> </xxxx> works with multiline

Submitted by http://stackoverflow.com/a/34423418/381149 - 8 years ago