// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Text.RegularExpressions; namespace E { public class Program { public static void Main(string[] args) { Regex matcher = new Regex(@"^ABC_\d{6}_\d{6}$", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline); MatchCollection matches = matcher.Matches("ABC_123456_789123\nABC_123456_789000"); Console.WriteLine(matches.Count); foreach (Match match in matches) { Console.WriteLine(match.Value); } } } }