关于邮箱格式匹配问题
来源:百度知道 编辑:UC知道 时间:2024/05/14 15:28:41
各位高手们,我用jsp做了个注册登陆页面,我想在注册的时候自动检测 邮箱的格式是否正确,请问要用什么方法.在次谢过了,只有20分了.
用正则表达式
Pattern p = Pattern
.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
Matcher m = p.matcher("liu.wang@3il_china.fr");
if (m.matches()) {
System.out.println("matches");
}
检索关键符。@ *.* 等等