regex to match xml tags not containing other tags
Posted
by
user1547254
on Stack Overflow
See other posts from Stack Overflow
or by user1547254
Published on 2012-08-28T03:30:03Z
Indexed on
2012/08/28
3:38 UTC
Read the original article
Hit count: 102
regex
Let's say I want to look for
<Address>
<Street>Windsor</Street>
</Address>
and I do not want to return
<Address>
<Number>15</Number>
<Street>Windsor</Street>
</Address>
i.e. I am looking for addresses where the Address node does not contain a number tag.
I tried things like <Address>(?!Number)</Address>
or <Address>.*?(?!Number).*?</Address>
but can't quite figure it out :-(
Any ideas?
TIA
eddiec :-)
© Stack Overflow or respective owner