Regular Expressions 101

Community Patterns

Extract names of XML attributes that have values

1

Regular Expression
PCRE (PHP <7.3)

/
<(\w*?)>.*<.*>
/
g

Description

Extracts attribute names from an XML file and presents them as a simple list. Affects only the attributes that have values. Ignores the "parent" attributes (that have no values but have nested attributes).

Submitted by O.Khilkevych / D.Mrachkovsyi - 9 years ago