How to do email validation? I have used following code to check validation for email.
final String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A- Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
Pattern pattern = Pattern.compile(EMAIL_PATTERN);
Matcher matcher = pattern.matcher(string);
The above code works fine, but if I enter the string as "example@gmail.com.com"
also,
the response i'm getting as true
.
I need to validate this. How can I validate this?. Please help me.