Regular Expressions 101

Community Patterns

Match HTML Tag Contents

0

Regular Expression
PCRE (PHP <7.3)

/
<([^>]+)>([^<]+)<(\/\1)>
/

Description

Capture group one is the tag's name, capture group two is the tag's contents.

Submitted by anonymous - 8 years ago