i want to use the NSRegularExpression Class to validate if an NSString is an email address.
Something like this pseudocode:
- (BOOL)validateMail : (NSString *)email
{
NSRegularExpression *expression = [NSRegularExpression regularExpressionWithPattern:@"" options:NSRegularExpressionCaseInsensitive error:NULL];
if(emailValidated)
{
return YES;
}else{
return NO;
}
}
But i don’t know how exactly i validate an NSString if it’s looking like this one “email@stackoverflow.com”
Perhaps someone can help me here.
Greetings
s4lfish
You can use:
you can test it here:
http://gskinner.com/RegExr/?2rhq7
And save this link it will help you with Regex in the future:
http://gskinner.com/RegExr/
EDIT
You can do it this way: