验证邮箱地址方法

验证邮箱地址是否合法:

- (BOOL)isAvailableEmail:(NSString*)emailString{
    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:emailString]; 
}

posted on 2012-06-27 14:54  黯夜曦  阅读(394)  评论(0编辑  收藏  举报

导航