//************************************** // Name: regular expression // Description:how to use regular expression to validate the input like phone number // By: hatem mostafa ahmed // // // Inputs:None // // Returns:None // //Assumes:None // //Side Effects:None //************************************** using System; using System.Text.RegularExpressions; public class Program { public static void Main() { Console.WriteLine("Hello World"); Regex rg = new Regex("^\\d{3}-\\d{7,10}$"); String text="011-344455554"; if(rg.IsMatch(text)) Console.WriteLine("write right numbers"); else Console.WriteLine("write wrong number"); } }