java正则表达

来源:互联网 发布:平安银行淘宝卡 白金卡 编辑:程序博客网 时间:2024/05/17 22:04

1、验证手机号

/**  * Description: 验证手机号码格式,符合要求返回true,否则false  * @date 2016年8月18日 上午9:56:26  * @author wheat  * @param str  * @return boolean  */  public static boolean isVerifyTelePhone(String str){Pattern regex = Pattern.compile("^1(3[0-9]|4[579]|5[0-9]|7[3678]|8[0-9])\\d{8}$");        Matcher matcher = regex.matcher(str);        return matcher.matches();}

0 0
原创粉丝点击