Community Patterns

Community Library Entry

0

Regular Expression
Created·2023-01-10 09:14
Flavor·PCRE2 (PHP)

/
<(?<tag>[^!\/>\s]+)((?:\s+((?<attrName>[^\/='"<>\s]+)(=(?<attrVal>('[^']*')|("[^"]*")|([^\s<>'"=`]+)))?)))*\s*\/?>
/
gm
Open regex in editor

Description

Regex pattern which matches HTML tag with its attributes.

Submitted by Bobkorinek