You can call the following text in a UITextField text:
- (BOOL)validateEmail:(NSString *)candidate { 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:candidate]; }
Apply emailRegex regex to your needs.
source share