Validate ZIP code

image_pdfimage_print
   


using System;
using System.Text.RegularExpressions;

class RegexSubstitution
{
   public static void Main()
   {

      string text = "124";
      if ( !Regex.Match( text, @"^d{5}$" ).Success )
      {
         Console.WriteLine( "Invalid zip code");
      }   
   }
}