You are assigned to develop email validation logic for EPractize Labs Email Marketing Software Express. |
Select the method to achieve this goal. |
Choice 1 |
public boolean isValidEmail(String emailAddress) {
static final String regex = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(emailAddress);
flag = m.matches();
return flag;
}
|
Choice 2 |
public boolean isValidEmail(String emailAddress) {
static final String regex = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
Pattern p = Pattern.compile(regex);
flag = p.matches(emailAddress);
return flag;
}
|
Choice 3 |
public boolean isValidEmail(String emailAddress) {
static final String regex = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
Pattern p = Pattern.compile(regex);
Matcher m = p.contains(emailAddress);
flag = m.matches();
return flag;
}
|