fork(1) download
  1. using System;
  2. using System.Linq;
  3. using System.Text.RegularExpressions;
  4.  
  5. namespace WindowsFormsApplication1
  6. {
  7. static class Program
  8. {
  9.  
  10. static void Main()
  11. {
  12. string s = "add(2,3,1),4";
  13.  
  14. MatchCollection matches = Regex.Matches(Regex.Matches(s, @"\(.*?\)").Cast<Match>().First().ToString(), @"\d+");
  15. string[] result = matches.Cast<Match>()
  16. .Take(10)
  17. .Select(match => match.Value)
  18. .ToArray();
  19. foreach (string item in result)
  20. {
  21. Console.WriteLine(item);
  22. }
  23.  
  24. }
  25. }
  26. }
  27.  
Success #stdin #stdout 0.07s 34112KB
stdin
Standard input is empty
stdout
2
3
1