The regular expression to validate email address using java.util.regex.Matcher
is failing. It throws invalid email address or false.
How would i modify the pattern to allow email address that ends with .services
import java.util.regex.Matcher;
import java.util.regex.Pattern;
String emailAddress = myemail@something.services;
public static Pattern EMAIL_PATTERN = Pattern.compile(
"^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
Matcher matcher = ADDR_PATTERN.matcher(emailAddress);
import java.util.regex.Matcher;
import java.util.regex.Pattern;
String emailAddress = myemail@something.services;
public static Pattern EMAIL_PATTERN = Pattern.compile(
"^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
Matcher matcher = ADDR_PATTERN.matcher(emailAddress);