How to keep the match found with RegEx

regex

#1

Hi

I have struggled for a number of times with keeping what I find using RegEx. I have the text below and are using the very simple “\d$” to identify the last number in the text…(4).

Normally I use “Programming.String.Replace” to get rid of any unwanted text. But there must be some way to KEEP the text identified with regex… I just cant find the correct function for it in uipath…

The answer must be basic but it keeps evading me - please help…

/Lars

See below for the text im searching in…:

Column1
1
0101
1
“140,67”
“140,67”
Valideret
FjlNrEdited
StatFelt
p
572
1032
11-07-2018
073334
28-2018
4


#2

Hi @larsjul

Wouldn’t a simple assign work for you?
Assign like this
yourVariable = System.Text.RegularExpressions.Regex.Match(yourVariable,"\d$").ToString

This will assign the result to the same variable, effectively only keeping what it found.
You can of course assign it to a different variable at that point.

Let me know if I misunderstood something.


#3

Hi again
Thank you so much - it worked!