Regular expression to get only numbers from string

Hello,

I have strings like this
(* 22,000_)

desired output
22000

I have tried this expression (?<=)[\d]+ but it just returns 22.

Thanks in advance

@Sarah_Tang

Check below for your reference as an alternative

Do a Replace as StringVariable.Replace(",","")

Now use below
system.Text.RegularExpressions.Regex.Match(ColumnData,"\d+")

Hope this may help you

Thanks

2 Likes

you can also replace anything else except numbers with nothing, which will give you a plane number string that can be converted into an integer. Syntax below

System.Text.RegularExpressions.Regex.Replace(“strTextTobBeTreated”,"\D","")

make sure to add the namespace System.RegularExpressions

2 Likes

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