Regex for this string to get only numbers from a string

input - "USD 67.33 hfgb "

I want output as just numbers - 67.33

Hi,

Can you try the following?

System.Text.RegularExpressions.Regex.Match(strData,"[.\d]+").Value

Regards,

3 Likes

tx it worked. just one more
input - $ 24

I need to extract the number after $ sign
I am using this regex
" (?<=USD|$|US$|US)[.\d]+"

but its not working maybe $ is a special symbol?

Hi,

Yes, $ is a special character. Please use \$ like US\$.

Regards,

1 Like

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