Just as a disclaimer, I just want to do this to make my life easier when reading logs.. Sometimes they have more than 100mb of text
I want to match a XML Group in which it contains some data.
Suppose I have a XML like below (and they are in the same line):
<car><id>1</id><acquiredDate>23-09-2016</acquiredDate><model>BMW</model></car>
<car><id>2</id><acquiredDate>23-09-2016</acquiredDate><model>BMW</model></car>
<car><id>3</id><acquiredDate>24-09-2016</acquiredDate><model>BMW</model></car>
<car><id>4</id><acquiredDate>23-09-2016</acquiredDate><model>BMW</model></car>
I want to match all cars that have were acquired on 23-09-2016. (3 matches on this case)
What I have so far is <car>.*?<acquiredDate>23-09-2016<\/acquiredDate>.*?<\/car>
, but it will match the third and fourth car together.
Something like:
<car><id>1</id><acquiredDate>23-09-2016</acquiredDate><model>BMW</model></car>
<car><id>2</id><acquiredDate>23-09-2016</acquiredDate><model>BMW</model></car>
<car><id>3</id><acquiredDate>24-09-2016</acquiredDate><model>BMW</model></car><car><id>4</id><acquiredDate>23-09-2016</acquiredDate><model>BMW</model></car>
I tried using something like <car>(?!.*<car>.*).*?<acquiredDate>23-09-2016<\/acquiredDate>.*?<\/car>
but it will match only the last.
How I achieve that?