How to extract decimal number after the $ symbol?

I have the following text:

Text = “We must receive your first payment of $10.00 soon”

using regex how can i search and retrieve the decimal number after the money symbol?

Thanks.

Assign a string variable to System.Text.RegularExpressions.Regex.Match(MyStr, "(?<=$)(\d+,*)+(\.\d+)*").Value, where MyStr contains your text with the “$” symbol.

@Anthony_Humphries
Can you check on escaping $ I guess we do need: (?<=\$)(\d+,*)+(\.\d+)*

1 Like

None of the above suggestions are working, i get a blank value. Here is my code:

Assign
text = “Thank you for your interest in this product. We must receive your first payment of $2.92 by 3/9/2020. lf you have already made your payment. please disregard this message.”

Assign
currency = System.Text.RegularExpressions.Regex.Match(text, “(?<=$)(\d+,)+(.\d+)”).Value

Write Line
currency.ToString (returns nothing a blank line)

Below is the actual XAML.
_Test - Copy.xaml (5.1 KB)

You can try this (?<=$)(\d+,)+(.\d+)

That looks about right but it’s not going through on my code for some reasons. Please look at these screenshots.


SS21

You need a ‘?’ after the ‘,’

System.Text.RegularExpressions.Regex.Match(text, “(?<=$)(\d+,?)+(.\d+)*”).Value

image

2 Likes

That worked!

Thank you.