How to remove the text in string manipulation

Hi all,

I am doing data extraction from pdf. However, I faced trouble in extracting one of the data.

The full line of the sentence is "Please note that if we do not receive your payment by 21 December 2020, a Notice to Attend Court may be issued " and I need to extract the date.

By using Substring, I managed to extract the date(21 December 2020), but the subsequent text (, a Notice to Attend Court may be issued ) also be extracted. I tried using replace and remove but both of them were failed.

So, could I know is there any alternative solution to solve it?

Thank you.

1 Like

Hello @Kun_Seng_Wong ,

Can you try this Expression (?<=your payment by).*(?=\,)

or to extract the only date you can try this, \d{1,3}\s[A-Za-z]+\s\d{4}


1 Like

Hi @Pradeep_Shiv

Is this solution can be done in UIpath because I never see this before.

Thank you.

1 Like

Hi, you first need to go to Imports section and import System.Text.RegularExpressions this will allow you to work with regular expressions. See attached screenshot. This will work as long as you date format did not change.

1 Like

Hi @Kun_Seng_Wong,

you can use Matches Activity!

Pattern: you can use above patterns
Input: pass your String Variable

and to print your output, you can use outVar(0).ToString (because it’s collection of Matches).

Noted, I will try now.

Thanks !!

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