I have trouble to look for specific block of code in an XML file.
The XML is similar to this sample:
<object>
<class>File</class>
<name>Fall</name>
<desc>Description of Seasons: Fall</desc>
</object>
<object>
<class>File</class>
<name>Summer</name>
<desc>Description of Seasons: Summer</desc>
</object>
<object>
<class>Image</class>
<name>Summer1</name>
<desc>Image of Seasons: Summer</desc>
</object>
<object>
<class>File</class>
<name>Weather3</name>
<desc>Description of Weather</desc>
</object>
Basically I want a regular expression to only return the second object named Summer
.
How would I go about this?
I am stuck here:
<object>(.*?)<class>File</class>(.*?)Description of Seasons: Summer(.*?)</object>
But I am getting the first object in my search results as well.
I have dot (.) to include new lines hence the syntax.