How do I match all the beginning tags in an XML document with RegEx? I just need to collect the tag names used.
This is what I have:
(?<=<)(.*?)((?= \/>)|(?=>))
this matches all the beginning and closing tags.
Example:
<Habazutty>yaddayadda</Habazutty>
<Vogons />
<Targ>blahblah</Targ>
Above code matches:
Habazutty
/Habazutty
Vogons
Targ
/Targ
I only need
Habazutty
Vogons
Targ
I couldn't figure out a way to exclude the closing tags. Negative lookahead didn't work - found nothing. I must have messed up.