using System; using System.Text.RegularExpressions; public class Test { public static void Main() { Regex regex = new Regex(@"\d{4}-\d{3,4}"); Match match = regex.Match("123456-12345"); if(match.Success) { Console.WriteLine(match.Value); } } }