Validate address : Regular Expression : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » Regular Expression »

 

Validate address








    

using System;
using System.Text.RegularExpressions;

class RegexSubstitution
{
   public static void Main()
   {

      string text = "124 street";
      if ( !Regex.Match( text, @"^[0-9]+\s+([a-zA-Z]+|[a-zA-Z]+\s[a-zA-Z]+)$" ).Success ) {
         Console.WriteLine( "Invalid address");
      } 
   }
}


           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» Regular Expression