I have an xml response in the following format
...
<field>
<fieldType>DOCUMENT</fieldType>
...
<fieldId>12345</fieldId>
<id>21345</id>
<isActive>F</isActive>
....
</field>
<field>
<fieldType>FOLDER</fieldType>
...
<fieldId>15345</fieldId>
<id>11345</id>
<isActive>T</isActive>
....
</field>
<field>
<fieldType>DOCUMENT</fieldType>
...
<fieldId>98765</fieldId>
<id>57689</id>
<isActive>T</isActive>
....
</field>
...
There are multiple such values in the xml. I need to extract only the fieldId 1. which is active i.e., T 2. which is of fieldType DOCUMENT.
I tried the following regex,
<fieldType>DOCUMENT</fieldType>.+?<fieldId>(.+?)</fieldId>.+?<isActive>T</isActive>
But this is extracting the 1st occurrence of fieldId, 12345 (even though it is not active) instead of 98765
P.s: I am trying to use this regex