How to get an invoice number at fixed format?

Hello, how could i get invoice numbers from multi files if it is at the following fixed pattern?

AAAABBBB-BBBBBB

A: Letters (A-Z)
B: Numbers (0-9)

Thanks so much.

Use a RegEx: [A-Z]{4}[0-9]{4}[0-9]{4}

Then read PDF as string and do a isMatch/Match.

1 Like

@itmonster999 if files are in pdf format read the file using read PDF Text activity and get the output in string variable(ex StrVariable) then apply below regex.

String InvoiceNum = System.Text.RegularExpressions.Regex.Match([A-Z]{4}[\d]{4}-[\d]{6}).ToString

2 Likes

Hi Manjuts90,

I receive the following message:
image

and how to apply StrVariable to the regex?

Thanks again

1 Like

@itmonster999 try below one and let me know.

String Invoice = System.Text.RegularExpressions.Regex.Match(strVariable,“[A-Z]{4}[\d]{4}-[\d]{6}”).ToString

2 Likes