email address validation in objective c


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. - (BOOL) validateEmail: (NSString *) emailstring {
  2. NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
  3. NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
  4.  
  5. return [emailTest evaluateWithObject:emailstring];
  6. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.