fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string subjectString = "Hello I'm 43 years old, I need 2 burgers each for 1.99$";
  9. MatchCollection mc = Regex.Matches(subjectString, "\\d+(\\.\\d+)?");
  10. foreach (Match m in mc)
  11. {
  12. Console.WriteLine(double.Parse(m.Groups[0].Value));
  13. }
  14. }
  15. }
Success #stdin #stdout 0.08s 34128KB
stdin
Standard input is empty
stdout
43
2
1.99