Reputation: 2592
i would like to check that whether the field entered in the text field is email or not.If its email field then proceed else show some alert or error. I don't know how to validate that field. Please help me out
Upvotes: 0
Views: 3559
Reputation: 2425
First add RegexKit
to your project.
Import RegexKitLite.h
to the class where you want to check the format
NSString *emailMatchstring=@"\\b([a-zA-Z0-9%_.+\\-]+)@([a-zA-Z0-9.\\-]+?\\.[a-zA-Z]{2,6})\\b";
compare this string to UITextField
's text.
Upvotes: 5
Reputation: 18428
I think the regular expression can help you.
NSRegularExpression Class Reference
Upvotes: 1