I am using the normal regular expression which most of us are using for Email validation.
Problem : Suppose if my Email id is : a@a.com, then after “com” if I press space twice, a full – stop gets appeared automatically.
I am using following code for validating email.
- (BOOL)validateEmailWithString:(NSString*)email
{
NSLog(@"helloo in validate");
NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
return [emailTest evaluateWithObject:email];
}
How do I avoid this full-stop ????
As I am a newbie to iphone development, Please help me out !!
A full stop appearing after two spaces is normal behavior. Most users know this and won’t be surprised when it happens. You can turn it off in the settings (General->Keyboard->”.” Shortcut).
If you really want to prevent it from happening, you can use the code in this answer. Note that you’ll have to set up the text field delegate for this to be called.