Skip to content

Instantly share code, notes, and snippets.

@jhurliman
Created March 16, 2015 20:59
Show Gist options
  • Save jhurliman/515074b04313761f08e3 to your computer and use it in GitHub Desktop.
Save jhurliman/515074b04313761f08e3 to your computer and use it in GitHub Desktop.
Email Validation in Objective-C
+ (BOOL)isValidEmail:(NSString *)str
{
NSString *emailRegex = @"[A-Z0-9a-z\\._%+-]+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
return [emailTest evaluateWithObject:str];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment