Find Jobs
Hire Freelancers

Need help with non-greedy regular expression

$10-30 USD

In Progress
Posted almost 5 years ago

$10-30 USD

Paid on delivery
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>
Project ID: 19455484

About the project

Remote project
Active 5 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs

About the client

Flag of SWEDEN
Täby, Sweden
5.0
21
Payment method verified
Member since Oct 2, 2014

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.