Email validation on textField in iOS

Use NSPredicate and Regex: – (BOOL)validateEmailWithString:(NSString*)email { 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]; } For a bunch of emails separated by a comma: – (NSMutableArray*)validateEmailWithString:(NSString*)emails { NSMutableArray *validEmails = [[NSMutableArray alloc] init]; NSArray *emailArray = [emails componentsSeparatedByString:@”,”]; for (NSString *email in emailArray) { NSString *emailRegex = … Read more

Email validation using regular expression in JSF 2 / PrimeFaces

All regular expression attempts to validate the email format based on Latin characters are broken. They do not support internationalized domain names which were available since May 2010. Yes, you read it right, non-Latin characters are since then allowed in domain names and thus also email addresses. That are thus extremely a lot of possible … Read more

override jquery validate plugin email address validation

I wouldn’t do this but for the sake of an answer you need to add your own custom validation. //custom validation rule $.validator.addMethod(“customemail”, function(value, element) { return /^\w+([-+.’]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(value); }, “Sorry, I’ve enabled very strict email validation” ); Then to your rules add: rules: { email: { required: { depends:function(){ $(this).val($.trim($(this).val())); return true; } }, customemail: … Read more

Check that an email address is valid on iOS [duplicate]

Good cocoa function: -(BOOL) NSStringIsValidEmail:(NSString *)checkString { BOOL stricterFilter = NO; // Discussion http://blog.logichigh.com/2010/09/02/validating-an-e-mail-address/ NSString *stricterFilterString = @”^[A-Z0-9a-z\\._%+-]+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2,4}$”; NSString *laxString = @”^.+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2}[A-Za-z]*$”; NSString *emailRegex = stricterFilter ? stricterFilterString : laxString; NSPredicate *emailTest = [NSPredicate predicateWithFormat:@”SELF MATCHES %@”, emailRegex]; return [emailTest evaluateWithObject:checkString]; } Discussion on Lax vs. Strict – http://blog.logichigh.com/2010/09/02/validating-an-e-mail-address/ And because categories are just better, … Read more

How to check edittext’s text is email address or not?

On Android 2.2+ use this: boolean isEmailValid(CharSequence email) { return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches(); } for example: EditText emailid = (EditText) loginView.findViewById(R.id.login_email); String getEmailId = emailid.getText().toString(); // Check if email id is valid or not if (!isEmailValid(getEmailId)){ new CustomToast().Show_Toast(getActivity(), loginView, “Your Email Id is Invalid.”); }

Best Regular Expression for Email Validation in C#

Email address: RFC 2822 Format Matches a normal email address. Does not check the top-level domain. Requires the “case insensitive” option to be ON. [a-z0-9!#$%&’*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&’*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])? Usage : bool isEmail = Regex.IsMatch(emailString, @”\A(?:[a-z0-9!#$%&’*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&’*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z”, RegexOptions.IgnoreCase);