fork(2) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string s = "[1]Ali ahmadi,[2]Mohammad Razavi";
  9. Regex regex = new Regex(@"\[(\d+)\]", RegexOptions.Compiled);
  10. foreach (Match match in regex.Matches(s))
  11. {
  12. Console.WriteLine(match.Groups[1].Value);
  13. }
  14. }
  15. }
Success #stdin #stdout 0.07s 37312KB
stdin
Standard input is empty
stdout
1
2