正则表达式验证邮箱格式

String check = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
String[] email = addressee.split("[,,]");
for (i = 0; i < email.length; i++) {
boolean flag = email[i].matches(check);
if (!flag) {
	throw new BadRequestException(ErrorCodeUtil.getApiError(ErrorCode.Resource.RES_40000064,"邮箱格式错误"));
	}
}

你可能感兴趣的:(正则表达式)