Validate Phone Number
using System; using System.Text.RegularExpressions; class RegexSubstitution { public static void Main() { string text = "124"; if ( !Regex.Match(text,@"^[1-9]\d{2}-[1-9]\d{2}-\d{4}$" ).Success ) { Console.WriteLine( "Invalid phone number"); } } }