Extraction of Text using Assign and Match Regex

Hi,

Could anyone please help me solve this issue as I am unable to get the result using Assign activity. Please see the attached XAML file.Invoice.txt (289 Bytes) PDF EXTRACTION.xaml (5.3 KB)

I am trying to get the Value1224521 for SOW ID # .

Hi
Welcome to uipath community
Use READ TEXT FILE activity and pass the file path txt file as input and get the output with a variable of type string named strinput
—now use a assign activity
strinput = String.Join(“”,strinput.Split(Environment.NewLine.ToArray()))

Again use a assign activity like this

str_output = System.Text.RegularExpressions.Regex.Match(strinput.ToString,”(?<=SOW ID #).*(?=Supplier)”).ToString.Trim

where str_output will be the output we need

Cheers @mc00476004

2 Likes

Thank you for the Swift reply. This works. I have around 50 PDF files with 20 Pages in each one of them. I need to extract 10 fields like this using Regexp from each Pdf and save them in an Excel sheet, Do you think using Regexp’s like this is the best suitable approach? I do not want to use Anchor base activity though.

I think the appropriate pattern would be (?<=SOW ID #).*?(?=Supplier) as the String “Supplier” appears more than once in the text file.

1 Like