LauraMM
(Laura)
September 10, 2020, 7:33pm
1
Hey guys.
My text looks like this:
Line 1 31 32
Line 2 12 14
Line 3 56 78
I want to create a RegEx code for UiPath, that extracts whatever number (in this case 14) that is in the end of line 2. A little challenge is, that I the spaces between the numbers can change. Here we got 5 spaces, but it could be 2 or 12, if that make sense.
Please help me
ppr
(Peter Preuss)
September 10, 2020, 7:38pm
2
@LauraMM
give a try on the pattern below
2 Likes
LauraMM
(Laura)
September 10, 2020, 7:47pm
3
Definately, but I only want the number in the end of Line 2. So I need to add something.
ppr
(Peter Preuss)
September 10, 2020, 8:03pm
4
can you the local panel view for the text variable.
Maybe we split on Environment.NewLine and take the second line
can take the second match only
Maybe we can anchor to “Line 2” text
Also check following:
with the retrieval of group 1
2 Likes
LauraMM
(Laura)
September 11, 2020, 7:07am
5
Hey ppr.
It doesn’t work. Or your code will take the entire second like. What I want it to do is to scan the input:
Line 1 31 32
Line 2 12 14
Line 3 56 78
And if we have a “Line 2”, it should extract the 14.
The input varies, as the spaces between the numbers could be more than 1.
ppr
(Peter Preuss)
September 11, 2020, 7:14am
6
But you fetched the Group value and Not the Match value, right?
1 Like
LauraMM
(Laura)
September 11, 2020, 7:19am
7
I am not sure, what you mean?
I’ve pasted in your code in regex101 (the extracted looks like yours), but putting in the same code in regexr give me a different result. See below:
ppr
(Peter Preuss)
September 11, 2020, 7:54am
8
refer to my screenshot from above where the value of interest is in group1. But give me some little time I will prepare some demo on different approaches for this case and willo share with you
1 Like
LauraMM
(Laura)
September 11, 2020, 8:04am
9
Thank you for your great effort. I am a little unsure, what I should copy of out of the expression to get the value of interest?
ppr
(Peter Preuss)
September 11, 2020, 8:13am
10
@LauraMM
just as a preview
Find demo case xaml here:
Get_2ndLine_PartRetrieval.xaml (6.1 KB)
2 Likes
system
(system)
Closed
November 8, 2020, 10:27am
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.