You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
409 B
12 lines
409 B
package utils;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
public class EmailValidator {
|
|
private static final Pattern EMAIL_PATTERN = Pattern.compile("^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$");
|
|
|
|
/*只检查邮箱的格式是否正确,但不保证这个邮箱存在*/
|
|
public static boolean isValid(String email) {
|
|
return email != null && EMAIL_PATTERN.matcher(email).matches();
|
|
}
|
|
} |