You can use this regex in principle and then expand it as it suits you:
Pattern email_rj = Pattern.compile("^[a-z0-9]+([.][a-z0-9]+)*[@]+[a-z0-9]+[.]+[a-z]{3,4}$");
boolean valid_em = email_rj.matcher("[email protected]").matches();
Allows you to see exactly what you are validating.
Where are the ñ and other special characters?
Addresses that contain non-ASCII characters are included in a rule called IDN : when you enter one, to be compatible with the current DNS system should be converted to Punycode and then be searched in its ASCII version.
For example if you enter eñe.com
, in reality the request sent is xn--ee-zja.com
Something to keep in mind is that, in principle, this is not a fully implemented standard.
Even, each valid email provider how you want the addresses that your users can create.
For example Google only allows characters from the a-z, 0-9 and points.
The safest way to validate an email is sent an email to it with a verification link, in order not to fall into contradictions.
If you only want to warn the user that you entered the wrong email, you can enter the special characters in the regex, assuming now that your provider allows this.