Can someone show me a sample RegEx for an email address and how to use in in Objective-C?
Looking for something that fits: name@place.something
NSString *string= @"my@mail.com her@mail.com him@mail.com";
NSError *error = NULL;
NSRegularExpression *regex = nil;
regex = [NSRegularExpression regularExpressionWithPattern:@"\\w+@[a-zA-Z_]+?\\.[a-zA-Z]{2,6}"
options:NSRegularExpressionCaseInsensitive
error:&error];
NSUInteger numberOfMatches = 0;
numberOfMatches = [regex numberOfMatchesInString:string
options:0
range:NSMakeRange(0, [string length])];
NSLog(@"numberOfMatches is: %lu", numberOfMatches);
There are more options of course. Read here.