I'm trying to validate an email with pattern object.
and it validates only 'xxxxx@'
I want that validates all 'xxx@zzz.yy'
the code is the following one:
public static boolean validateEmail(String ca) {
Pattern pattern= Pattern.compile("[a-zA-Z0-9_]+[.[a-zA-Z0-9]+]*@[a-zA-Z0-9_]+[.[a-zA-Z]+]+");
Matcher en= pattern.matcher(ca);
return !en.matches();
}
what's the problem?
what am I doing wrong?