namespace _11_RegularExpressions { class Class1 { [STAThread] static void Main(string[] args) { Regex phoneExp = new Regex(@"^(234[7|8][0|1][2-9])([0-9]{7}$"); string input; Console.Write("Enter a phone number: "); input = Console.ReadLine(); while (phoneExp.Match(input).Success == false) { Console.WriteLine("Invalid input. Try again."); Console.Write("Enter a phone number: "); input = Console.ReadLine(); } Console.WriteLine("Validated!");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)