×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Objective-C
Posted by: Black Light
Added: Mar 3, 2013 12:20 PM
Views: 20
Tags: no tags
  1. - (BOOL) validateEmail: (NSString *) candidate
  2. {
  3.     NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}";
  4.     NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
  5.     return [emailTest evaluateWithObject:candidate];
  6. }
  7.