-(BOOL)emailValidation:(NSString *)email {
BOOL result;
//checking email validation
NSString *emailRegEx = @"[A-Z0-9a-z._-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegEx];
//Valid email address
if ([emailTest evaluateWithObject:email] == YES){
NSLog(@"Valid email address");
result=NO;
}else{
NSLog(@"Invalid email address");
result=YES;
}
return result;
}
BOOL result;
//checking email validation
NSString *emailRegEx = @"[A-Z0-9a-z._-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegEx];
//Valid email address
if ([emailTest evaluateWithObject:email] == YES){
NSLog(@"Valid email address");
result=NO;
}else{
NSLog(@"Invalid email address");
result=YES;
}
return result;
}
No comments:
Post a Comment