您的位置:首页 > 其它

判断手机号和邮箱

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();
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  手机 邮箱