判断手机号和邮箱
2015-07-27 11:00
176 查看
/**
* 注册工具类,判断手机号、邮箱。。。
* @author wxl
*
*/
public class RegisterUtil {
public static boolean isMobileNum(String mobiles) {
Pattern p = Pattern
.compile("^((1[0-9][0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$");
Matcher m = p.matcher(mobiles);
System.out.println(m.matches() + "---");
return m.matches();
}
public static boolean isEmail(String email) {
String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
Pattern p = Pattern.compile(str);
Matcher m = p.matcher(email);
return m.matches();
}
}
* 注册工具类,判断手机号、邮箱。。。
* @author wxl
*
*/
public class RegisterUtil {
public static boolean isMobileNum(String mobiles) {
Pattern p = Pattern
.compile("^((1[0-9][0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$");
Matcher m = p.matcher(mobiles);
System.out.println(m.matches() + "---");
return m.matches();
}
public static boolean isEmail(String email) {
String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
Pattern p = Pattern.compile(str);
Matcher m = p.matcher(email);
return m.matches();
}
}
相关文章推荐
- Android之获取手机上的图片和视频缩略图thumbnails
- android wifi 无线调试
- 手机4大隐藏功能及使用必知常识第1/2页
- 使用Ajax实时检测"用户名、邮箱等"是否已经存在
- 邮箱网站不能用mail.xxx.com:8888的方式访问原因
- hotmail,MSN 邮箱无法登陆的解决方法 秘密通道
- php实现用手机关闭计算机(电脑)的方法
- js判断手机和pc端选择不同执行事件的方法
- JS判断客户端是手机还是PC的2个代码
- jQuery 实现自动填充邮箱功能(带下拉提示)
- android获取手机唯一标识的方法
- 让手机访问WAP网站服务器 IIS WAP服务器的MIME类型设置
- 手机短信轰炸(图)
- android检查手机和无线是否连接的方法
- Android获取手机通讯录、sim卡联系人及调用拨号界面方法
- Android中获得手机屏幕大小实现代码
- Android手机获取IP地址的两种方法
- android开发教程之判断是手机还是平板的方法
- Android实现判断手机未接来电及处理方法