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
- (BOOL)isValidEmailAddress:(NSString *)text { | |
NSError *error = NULL; | |
NSRange textRange = {0, [text length]}; | |
NSDataDetector *detector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:&error]; | |
if (!detector) { | |
NSLog(@"Could not instantiate link detector for email validation: %@", error); | |
return NO; | |
} | |
NSTextCheckingResult *result = [detector firstMatchInString:text options:0 range:textRange]; |