I have a regular expression to validate an email and when I run it, it constantly tells me that its an invalid email address but the email is correct
email = (EditText) findViewById(R.id.email);
final String Email = email.getText().toString();
if (!Email.matches("^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$"))
{
email.requestFocus();
email.setError("INVALID EMAIL ADDRESS");
}
Does anyone know it would give me the error even though it is correct?