Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
<\/?(?:\b(?!(?:div|tag)\b))([a-zA-Z0-9]+).*?>
/
g

Description

Matches any text starts with "<" straight followed by alphanumeric characters and ends with ">"; Tag exclusions described in first non-capturing group (can be removed); Tag name will be captured by group #1;

Submitted by Pavel Savkin aka nhaizere - 10 years ago