I am new to using regular expressions and I can understand how I am going to extract a specific number from a string.
Suppose a string is any number of spaces or random texts, and somewhere inside this value, "Value: $ 1,000.00."
To get this value, I am currently using this:
string value = Convert.ToString(Regex.Match(BodyContent, @"Value:[ \t]*\$?\d*(\.[0-9]{2})?", RegexOptions.Singleline));
So, the variable 'value' now has the value "Value: $ 1000.00" in it.
My question is, with Regex, is there a way to use the value "Value:" to find the value of a number, but store only the actual numerical value (ie 1000.00) in the variable "value"?
source
share