Extract Specific numbers from PDF

How do i extract the highlighted text using Indexof?

Capture
Below is the formula so far i have used:
strInvoiceText.Substring(strInvoiceText.IndexOf(“PAID-UP ,ORDINARY SINGAPORE”)+3869).Split(Environment.NewLine.ToCharArray)(0).Trim

Was trying to extract a specific string of numbers from a PDF file.

Tried 2 different Regex expression below:

system.text.RegularExpressions.Regex.Match(strInvoiceText,“(?<=PAID-UP ,ORDINARY SINGAPORE, DOLLARS\s\s)(.*)\d(?=\s)”).Value

system.text.RegularExpressions.Regex.Match(strInvoiceText,“(?<=PAID-UP ,ORDINARY SINGAPORE, DOLLARS\s\s)(\d.+\d)”).Value).Replace(" “,”")

but somehow UIpath is not able to extract thus resort to using Indexof.

Attaching the PDF file for reference.
1.pdf (136.1 KB)

Appreciate the help in advance!

Hi @Justine ,

Could you try using the Regex Expression below :

(?<=PAID-UP\s+,ORDINARY\s+SINGAPORE, DOLLARS\s+)[\d.,]+

Expression :

System.Text.RegularExpressions.Regex.Match(pdfText,"(?<=PAID-UP\s+,ORDINARY\s+SINGAPORE, DOLLARS\s+)[\d.,]+",RegexOptions.IgnoreCase).Value

Let us know if this doesn’t work.

1 Like

hi @supermanPunch , it works perfectly. thanks for the help!

1 Like

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