<Regex> Want to extract value of invoice number from below mentioned text

Want to extract invoice value from below text. Invoice number text can be of any case, but it would definitely be alphanumeric but can be of any length. thanks in advance.

TEXT:
TEXT DOC.txt (152 Bytes)

Hi @anjasing

(?<=invoice\s*Number\s*)([A-Za-z0-9]+)

1 Like

@anjasing

Output=System.Text.RegularExpressions.Regex.Match(InputText,"(?<=invoice\s*Number\s+)[A-Z\d]+").Value
1 Like

Hi @anjasing

[A-Za-z0-9]+(?=\/)

use in the assign activity as below:

Input = "abcdef ghijk lmnop invoice Number ABCD116PQ12345/br>Order Type: </br></br></br>Current Rate </br>PWR </br>Code  </br> </br>Screenshots: New Bitmap </br>"


Output = System.Text.RegularExpressions.Regex.Match(Input,"[A-Za-z0-9]+(?=\/)").Value

Regards

1 Like

Hi @anjasing

(?<=invoice Number ).*(?=/br>Order Type:)

1 Like

Hey, but it should have no dependence on order type

Hi @anjasing

(?<=invoice Number\s)[A-Z|a-z|0-9]+

1 Like

Hi @anjasing

Please check this:

1 Like

Right now, I am checking on Regex checker. But it’s not matching it correctly. https://regex101.com/

Hi @anjasing

use the regexr.com

Regards

1 Like

@anjasing

Use this website to write regex expressions

1 Like

@anjasing

You can try this

(?<=invoice Number ).*\d+

1 Like

Hi @anjasing

Use below Regex Expression

System.Text.RegularExpressions.Regex.Match(Text,β€œ(?<=invoice Number ).*(?=/br>Order Type:)”).Value

Hope it will helps you :slight_smile:
Cheers!!

1 Like

Thank you for helping out.

Hi @supriya117 ,

this expression is working but I want it be independent of upper case and lower case.

?<=invoice\sNumber: \s)([A-Za-z0-9]+)

@anjasing

It is independent of upper case and lower case
image

Sure, but my ask was it should be independent of order type.

No, I meant invoice number text should be independent of upper/lower case not invoice number value

HI @anjasing

Please ceck with my regex.

[A-Za-z0-9]+(?=\/)

Regards

This is working fine but invoice number text should be independent of upper/lower case.

For reference:

(?<=invoice\sNumber: \s)([A-Za-z0-9]+)