How to get only Numeric value from Alphanumeric from excel?

Hi all,
I am trying to Get only the Numeric value from an alphaNumeric from excel cell…

Ex: USD 16

I only want the value 16.

Regards,
Rahul

2 Likes

Hi @rahul_gola

It helps you. regex

(?<=$)[\d., ]+(?=$)

Hi KMota,

Thank you for the quick response.

i am pretty new to uipath. i dont know where to keep this value i have created a variable called (vCost) where the output i am getting is usd 16, i dont know where i have to keep this regex solution which you have provided.
i have attached an screenshot for your reference!

Regards,
Rahul

in Message Box type it

System.Text.RegularExpressions.Regex.Match(vCost, “(?<=$)[\d]+(?=$)”, System.Text.RegularExpressions.RegexOptions.IgnoreCase).Value.Trim

See what the output
or if there are any errors

always the characters will be $ and US ?

if yes type
.Replace("$","")
.Replace(“US”,"")

no the character is always USD 16.

i have tried the above and the message box is coming as blank!.
ss attached

Hi
Use a Message box activity with this expression
System.Text.RegularExpressions.Regex.Match(str_inlut.ToString,”[\d].*”).ToString
Where str_input is a string variable holding the value in it

Cheers @rahul_gola

3 Likes

Try Replace

image

1 Like

@rahul_gola

solution @Palaniyappan works
ever rsrs
image

1 Like

Thank you KMota for the support.

1 Like

Thank you @Palaniyappan for the support the solution worked!

Cheers,
Rahul

1 Like

HI @palaniyappan, i am trying to get the same in the excel when i remove the read cell value with the System.Text.RegularExpressions.Regex.Match(str_inlut.ToString,”[\d].*”).ToString i am not able to get it. it says object is not set

We won’t be able to direct have this expression in READ CELL activity
That activity would first read the value from the particular cell and store that value in a variable
Then that variable can be used in this expressions as a string input
Cheers @rahul_gola

great got it… thank you once again

1 Like

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