Java验证邮箱格式是否正确的正则表达式
java
import java.util.regex.Pattern;
public class EmailUtil {
final static Pattern partern = Pattern.compile("[a-zA-Z0-9]+[\\.]{0,1}[a-zA-Z0-9]+@[a-zA-Z0-9]+\\.[a-zA-Z]+");
/**
* 验证输入的邮箱格式是否符合
* @param email
* @return 是否合法
*/
public static boolean emailFormat(String email){
boolean isMatch = partern.matcher(email).matches();
return isMatch;
}
}