How to extract particular text using Match activity in Uipath

Hi team,

I am new to this uipath.
I am trying to extract a value from the output message getting in the sap and save it to excel.
I have used data scrapping and get text to get the 2 output message as below

Created Request UIPK900246 with Task UIPK900247 for ABC
Created Request UIPK900248 with Task UIPK900287 for ABC

From this above text message i need to get only the request number(only the 3rd text which is there after Request) UIPK900246 and UIPK900248 one by one.

Can you please help how to get this particular TR number with the help of Match activity.

Regards,
Bhagyashree

Hi @_Bhagyashree

How about this expression

System.Text.RegularExpressions.Regex.Matches(YourString,"(?<=Created Request\s)\S*").Value

image

Regards
Gokul

1 Like

Hi @_Bhagyashree

Check out the XAML file

MatchesRegex1.xaml (13.0 KB)

Output Snap

image

Regards
gokul

Hello @_Bhagyashree

Ypu can use the Matches activity and use the regex builder to create the expression as below.

(?<=Created Request )\w+

You will get a collection of founded match.

Thanks

Hi @_Bhagyashree

You can alao do this way using split

Let say required string is stored in str

Str.split({“ Created Request”, “with Task”},StringSplitOptioms.None)(1)

Use this in assign and if you are copy pasting please replace inverted comma again in your code

Cheers

Thank you @Gokul001

I have used the same but how to get the output of the match in message box.

Hi @_Bhagyashree

Just use Message box activity

image

Regards
Gokul

Hi @_Bhagyashree

Use a for loop and change type argument as below and currentitem.value

In In Argument pass the output of matches

cheers

Hi @Gokul001

currentitem is the output of match activity right?

Yes @_Bhagyashree

Have you test the XAML file?

Hi @_Bhagyashree

No currentItem is the for loop each item value …create a output in match expressions and give the same variable in IN field

“MatchExpressions” - Place the output variable here

image

cheers

Hi,

I have used match activity and i am getting null value.

Regards,
Bhagyashree

Why dont you try with Assign nd For each activity to get the result? Have you tried that? @_Bhagyashree

@_Bhagyashree

Either change the qualifier to any number or use an assign activity.

Cheers

Hi,

I have tried with assign and for each


@_Bhagyashree

The regex is not giving any output its giving a blank value hence youa are getting this error

Cheers

I have passed the correct match value

Hi @_Bhagyashree

The value that you gave in for each ‘in’ argument is null… the regex might not be extracting correctly may be it is failing to extract the value

May i know are you using matches or match?

Cheers

Have you checked this XAML file @_Bhagyashree

May be you can share the exact input file

I have used Matches