I want help defining a rx pattern that only picks one single Invoice-tag from the example source below using the exact InvoiceNo. I have tried using "<Invoice>.*?<InvoiceNo>456<\/InvoiceNo>.*?</Invoice>" to match the middle one, but it returns everything from the start <Invoice>. How can I make this pattern non-greedy? I thought the "?" would do this.
The pattern must work in .Net.
Please add an appropriate comment to your bid that shows you are not a bot.
=============================================
Code to base the pattern on:
<?xml version="1.0" encoding="utf-8"?>
<root>
<Invoice>
<InvoiceNo>123</InvoiceNo>
<Details>abc</Details>
</Invoice>
<Invoice>
<InvoiceNo>456</InvoiceNo>
<Details>def</Details>
</Invoice>
<Invoice>
<InvoiceNo>789</InvoiceNo>
<Details>ghi</Details>
</Invoice>
</root>