I have the following string:
<SomeXmlProperty att="abc"
att2="def"
att3="ghi"/>
<SomeXmlProperty att4="jkl"
att5="mno"
att6="pqr"><SomeXmlProperty>
<SomeXmlProperty att="stu"
att3="vwx"
att6="yz"
/>
I am needing to match the elements with self closing tags.
I have tried using both <SomeXmlProperty((.|\n|\r)*)\/>
and <SomeXmlProperty((.|\n|\r)*?)\/>
which get close but the middle element still gets matched. What am I doing wrong here?
You can use a character class that excludes <
s instead to avoid matching multiple tags:
<SomeXmlProperty[^<]*\/>