String manipulation in Variable

Hi

I have a variable called EmpName = “Srinivasa (125122)”

I want take only number part 125122 in the variable and put into new variable called EmpId.

Can any one help please!!

Thanks
Srini

resultString = Regex.Match(EmpName, "\d+").ToString

Parse into Integer if required.

Thank you so much KathikByggari !!
I have copy pasted whatever you have given.
image

I am getting validation error.
I am new to UiPath. Could you please explain bit more?

Thanks

Please let me know what is the error message?
Place mouse at the Exclamation mark (!) and send me the error screenshot.

Here is :
image

Remove @ from the expression.
If still error is there, in the expression write like this "\\d+"

There is another way doing this with a String-Split - although I would agree with @KarthikByggari that RegEx is the better solution!

For the split you can use this code assigned to a string variable:
EmpID = EmpName.Split("(".ToCharArray).Last.ToString.Replace(")",String.Empty)

1 Like

No luck KarthikByggari !!
image

But other solution is working which is given by FrankSchikora

It is working fine FrankSchilora !!

Thanks a lot !! :slight_smile:

Regex.Match(strEmp,"\d+").ToString

.Value in the expression is in C#. I am a bit confused.

1 Like

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