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
Gokul001
(Gokul Balaji)
December 6, 2022, 6:51am
3
Hi @_Bhagyashree
How about this expression
System.Text.RegularExpressions.Regex.Matches(YourString,"(?<=Created Request\s)\S*").Value
Regards
Gokul
1 Like
Gokul001
(Gokul Balaji)
December 6, 2022, 6:55am
4
Hi @_Bhagyashree
Check out the XAML file
MatchesRegex1.xaml (13.0 KB)
Output Snap
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
Anil_G
(Anil Gorthi)
December 6, 2022, 7:16am
6
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.
Gokul001
(Gokul Balaji)
December 6, 2022, 9:43am
8
Hi @_Bhagyashree
Just use Message box activity
Regards
Gokul
Anil_G
(Anil Gorthi)
December 6, 2022, 9:44am
9
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?
Gokul001
(Gokul Balaji)
December 6, 2022, 9:47am
11
Yes @_Bhagyashree
Have you test the XAML file?
Anil_G
(Anil Gorthi)
December 6, 2022, 9:48am
12
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
cheers
Hi,
I have used match activity and i am getting null value.
Regards,
Bhagyashree
Gokul001
(Gokul Balaji)
December 8, 2022, 4:53am
15
Why dont you try with Assign nd For each activity to get the result? Have you tried that? @_Bhagyashree
Anil_G
(Anil Gorthi)
December 8, 2022, 5:09am
16
@_Bhagyashree
Either change the qualifier to any number or use an assign activity.
Cheers
Hi,
I have tried with assign and for each
Anil_G
(Anil Gorthi)
December 8, 2022, 4:31pm
18
@_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
Anil_G
(Anil Gorthi)
December 8, 2022, 4:43pm
20
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
Gokul001
(Gokul Balaji)
December 9, 2022, 4:20am
21
Have you checked this XAML file @_Bhagyashree
May be you can share the exact input file