I m working on a code which was implemented by someone else which is as follows
+(BOOL)emailValidate:(NSString *)email {
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:email];
}
+(BOOL) IDValidate:(NSString *)ID {
NSString *regexString = @"[ A-Z0-9a-z_+-]{1,20}";
NSPredicate *regex = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regexString];
return [regex evaluateWithObject:ID];
}
I want to alow spaces " " and commas "," in ID and email, I search a lot how to alter predicateFormat but could not find the answer.