Skip to content

Instantly share code, notes, and snippets.

@azcoov
Created August 16, 2011 07:11
Show Gist options
  • Save azcoov/1148589 to your computer and use it in GitHub Desktop.
Save azcoov/1148589 to your computer and use it in GitHub Desktop.
U.S. Postal Code Validation
private Boolean IsValidUSZip(String number)
{
String pattern = @"^(\d{5}-\d{4}|\d{5}|\d{9})$";
var match = new Regex(pattern);
return match.IsMatch(number);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment