using System; using System.Text.RegularExpressions; public class Test { public static void Main() { string testStr = "|12||13||14|"; var testMatch = Regex.Match(testStr, @"^(?:\|([0-9]+)\|)+$"); int captureCtr = 0; foreach (Capture capture in testMatch.Groups[1].Captures) { Console.WriteLine("Capture {0}: {1}", captureCtr++, capture.Value); } } }