I want to know that is there any way to validate the the zipcode of US or Zipcode of Canada?I have tried to use regex. Like for US
- (BOOL)validateZip:(NSString *)candidate {
NSString *emailRegex = @"(^{5}(-{4})?$)|(^[ABCEGHJKLMNPRSTVXY][A-Z][- ]*[A-Z]$)";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
return [emailTest evaluateWithObject:candidate];
}
but it's not working.Please any body have any idea regarding this validation.if any rest api is there for the validation?Please guide me if possible?