Objective C中E-mail地址验证

1 -(BOOL)isValidateEmail:(NSString *)email

2 {

3     NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";

4     NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];

5     return [emailTest evaluateWithObject:email];

6 }

 

你可能感兴趣的:(objective c)