Regular Expression C# Tutorial

using System;
using System.Text.RegularExpressions;
  class Class1
  {
    [STAThread]
    static void Main(string[] args)
    {
        Regex phoneExp = new Regex( @"^\(\d{3}\)\s\d{3}-\d{4}$" );
          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!" );
    }
  }