using System; using System.Text.RegularExpressions; public class Test { public static void Main() { string subjectString = "Hello I'm 43 years old, I need 2 burgers each for 1.99$"; MatchCollection mc = Regex.Matches(subjectString, "\\d+(\\.\\d+)?"); foreach (Match m in mc) { Console.WriteLine(double.Parse(m.Groups[0].Value)); } } }