Regex assistance

I’m hoping to find some assistance with Regex, I’m trying to pull specific text from a PDF and having a lot of trouble with it. The selector initially worked but is now failing and when attempting to make changes to it the selector now highlights the entire page so I’m not sure that will be the best route to follow. Looking through the forums it seems Regex is preferred for PDF’s anyway - I’ve not used Regex as of yet so hoping for some help here while I’m learning.

I have a screen attached of the bottom of a large PDF, I need to capture the dollar amount in the screen:

We can use this website to test and find the perfect Regex to be used in MATCHES activity

Kindly try this and let know for any queries or clarification
Cheers @mgeatches

This is what I’ve got so far, if I understand correctly I should be using my anchor in the first matching group and what I want to capture in the 2nd?

System.Text.RegularExpressions.Regex.Match(PDFText,^“Total Transactions Accepted for File:\s($.)\n”).Groups(1).Value.ToString

After tinkering on the site it looks like my expression is correct but when I run it in a workflow and write the return it’s blank. Regex below:

@Palaniyappan

1 Like

This expression would work in that case
System.Text.RegularExpressions.Regex.Match(yourstringvariable.ToString,“(?<=Total Transactions Accepted for File:).+(?=\s)“).ToString.Trim

Cheers @mgeatches

1 Like

Thank you!

1 Like

Please do not suggest regex101.com! It does not have .net, so anything made could potentially not work as .net does not have a lot of the higher-level syntax as in other languages.

Anything made on this is likely to work in UiPath: .NET Regex Tester - Regex Storm

2 Likes

Thank you so much @dmccammond
I will try with that too :blush:

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