REGEX ERROR INVOICE

Hello, I have an invoice and I want to get the “Order No” part from it, but sometimes it sounds like number 1. (Order No: 1111) sometimes it sounds like number 2.(pages $ 2:order:11111) How do I write a common regex for both cases? How can I do that ? Or is there another way?


(?<=Order No: ?|order: ?)\d+

1 Like

Hey!

Try like this

System.Text.RegularExpressions.regex.match(InputString,"(?<=Order No: |order: )\d+").ToString 

Regards,
NaNi

Capture

i tried but it didn’t work

your pattern was not described above for the third case: order : 256728 vs order:11111

as long you come up with variations you can risk the result. So better to tell us in advance variations


(?<=Order No: ?|order ?: ?)\d+

Maybe also a more defensive and case insensitive pattern will help:
grafik
(?<=order.*?)\d+
So just also activate the RegexOptions.IgnoreCase for the above pattern

how ?

RegexOptions.IgnoreCase

or

grafik

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.