public static bool IsValid (string postcode)
{
if (postcode == "") return true;
System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(@"^(\d{5}-\d{4}|\d{5}|\d{9})$|^([a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d)$");
return r.IsMatch(postcode.ToUpper());
}
No comments:
Post a Comment