fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6.  
  7. public class Test
  8. {
  9. public static void Main()
  10. {
  11. var s = "+33.22+10.22+11.22+4.43+4.43";
  12. var m = Regex.Match(s, @"^([+-]?(?:\d{1,2}\.\d{1,2}|\d{1,3})\b){1,5}$");
  13. if (m.Success)
  14. {
  15. var captures = m.Groups[1].Captures.Cast<Capture>().Select(p => p.Value).ToList();
  16. foreach (var x in captures)
  17. Console.WriteLine(x);
  18. }
  19. else
  20. {
  21. Console.WriteLine("No match!");
  22. }
  23. }
  24. }
Success #stdin #stdout 0.08s 134592KB
stdin
Standard input is empty
stdout
+33.22
+10.22
+11.22
+4.43
+4.43