Need regex for Below string value need amount value

Hi team,

my string value =“$9.50 - USPS Priority - Wed 10/2 - 9:00am CT”

i need output as $9.50 or 9.50

can you anyone help me this,

Regards
Sai

Hi,
Can you try either of the following?

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

OR

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

Regards,

1 Like

Hi @Mada_Sai_Krishna

You can also try this regex to get $9.50
strExtractedValue = System.Text.RegularExpressions.Regex.Match(inputString, “$\d+.\d+”).Value
and to get output as 9.50
strNumValue = strExtractedValue.Replace(“$”, “”)

Thanks,

Hi @Mada_Sai_Krishna

try this way,

\$\d+.\d+

image

Regards,
Gowtham K