RegEx with UiPath Problem

I am new to UiPath. I have a problem that I am not able to match pattern in a pdf file.
I need to pick up the PO No from the pdf file.
The format in which it is given is

PO No.: 222
Invoice No : 2345

The regex that I am using is

System.Text.RegularExpressions.regex.Match(CurrentFileName,“(?<=PO No\s*)\w+”).Value

Can somebody please help to point out the error?

Thanks in advance

can you try:

System.Text.RegularExpressions.regex.Match(CurrentFileName,"(?<=PO\sNo[\s.:]+)\w+").Value

\s is not containing . or :
grafik

Hi @kundu02

You should be able to extract the PO number by

System.Text.RegularExpressions.Regex.Match(CurrentFileName, “(?<=PO No.:\s)\d+”).Value

Thanks

Thanks … But somehow it is returning a null string with this regex

My requirement is to extract the po number , invoice number from this …
I am unable to upload the pdf file , so I am pasting the layout here

Invoice
9020
Customer: Tampines Affec􀆟onate Finds
Email: TPAFData@gmail.com
Address: 112 Robinson Road
Date: 9/19/2024
Invoice No: 8912
PO No.: 318
Descrip􀆟on Unit Price ($) Qty Total ($)
Mini Croissant 2 10 20
Mini Eclair 3 20 60
Amount Due: 80
Payment to be made direct to: Central Bank 220‐66960‐8
Payment Due: 30 days from date of invoices
Thank you. We look forward to being of service to you again.

Thanks for your guidance

Hello @kundu02

@ppr 's regex pattern should work perfectly. It works from your sample provided.

Can you paste a screenshot of the text from the locals pane in Studio once you have read the PDF?

Cheers

Steve

Thank you so much all of you . It works perfectly.

Now my next query is that there is a Company Name either in Capital letters or in Italics in the PDF even before the Invoice.
How to pick that up based on the font ??

If you get an invoice from a company, they are one of your suppliers and you have the details already. So create a list of all suppliers and try to match first few lines on the invoice.

I think it would be best to use Digitize Document and use Keyword Classifiers at the beginning of the process.

Hi @kundu02

Please mark the reply from @ppr as a solution.

As for your follow up question/s I would suggest making a new post.

Cheers

Steve