I have searched for a few Q & As and cannot find a solution that is adequate enough to help.
I have a large XML file and you need to do a conditional βdeleteβ in one field depending on the value in another field.
For instance:
<vehicle>...<manufacturer>JCB</manufacturer>....<item_category>JCB Tractors</item_category>...</vehicle><vehicle>...<manufacturer>Caterpillar</manufacturer>....<item_category>Digger</item_category>...</vehicle><vehicle>...<manufacturer>Caterpillar</manufacturer>....<item_category>Caterpillar Digger</item_category>...</vehicle>
should become
<vehicle>...<manufacturer>JCB</manufacturer>...<item_category>Tractors</item_category>...</vehicle><vehicle>...<manufacturer>Caterpillar</manufacturer>...<item_category>Digger</item_category>...</vehicle><vehicle>...<manufacturer>Caterpillar</manufacturer>....<item_category>Digger</item_category>...</vehicle>
Ideally, the solution would be what I could apply using the search and replace function in the text panel set to the POSIX extended regular expression.
Actually I appreciate the help in this, as I hit my head about it several times!
If I use a parser, I can highlight the string of the variable that I want to delete using
(?<=<manufacturer>)(.*?)(?=<\/manufacturer>)
Is it possible to use this pattern to highlight the line that I really want to delete.
eg.
(?<=<item_category>)(?<=<manufacturer>)(.*?)(?=<\/manufacturer>)(\s)