Created
March 21, 2016 02:37
-
-
Save CaliosD/e12821df2a6f1312f646 to your computer and use it in GitHub Desktop.
判断邮箱格式是否正确(利用正则表达式验证)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(BOOL)isValidateEmail:(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]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment