using System.Text.RegularExpressions;
public static void Main()
string pattern = @"([\d-\s]+)";
RegexOptions real_options = RegexOptions.None;
Regex re = new Regex(pattern, real_options);
int [] group_nums = re.GetGroupNumbers ();
Match m = re.Match (input);
for (int i = 0; i < m.Groups.Count; ++ i) {
int gid = group_nums [i];
Group group = m.Groups [gid];
result += " Group[" + gid + "]=";
foreach (Capture cap in group.Captures)
result += "(" + cap.Index + "," + cap.Length + ")";
error = e.Message + "\n" + e.StackTrace + "\n\n";
Console.WriteLine("result: {0} error: {1}", result, error);