Created
March 11, 2013 05:13
-
-
Save helloworld116/5132033 to your computer and use it in GitHub Desktop.
regex:email
This file contains hidden or 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
//objective-c使用正则表达式验证邮箱 | |
+ (BOOL)isEmailAddress:(NSString*)email { | |
NSString *emailRegex = @"^\\w+((\\-\\w+)|(\\.\\w+))*@[A-Za-z0-9]+((\\.|\\-)[A-Za-z0-9]+)*.[A-Za-z0-9]+$"; | |
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