Check if email is valid

by alex 19. May 2009 14:22

#import "GTMRegex.h"

 

//Check if email is valid

//You need to include attached files into your project 

//We are using regular expressions in this method

-(BOOL)isEmailValid:(NSString *)email {

BOOL isValid = YES;

NSString *emailRegEx = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";

GTMRegex *regex = [GTMRegex regexWithPattern:emailRegEx];

if(([regex matchesString:email]) == YES){

NSLog(@"Registration Form: You have entered valid email address %@", email); 

}

else {

NSLog(@"Registration Form: You have entered INVALID email address %@", email); 

isValid = NO;

}

return isValid;

}


Archive.zip (15.13 kb)

Tags:

General

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen