港澳台手机号正则 |
您所在的位置:网站首页 › 香港电话区号格式 › 港澳台手机号正则 |
/* 1.大陆的 1+(3—9)+任意九位数 ^[1][3-9]\d{9}$ 2.香港(5|6|9)+任意七位数 ^([5|6|9])\\d{7}$ 3.台湾 09+任意八位数 ^[0][9]\\d{8}$ 4.澳门6+任意七位数 ^[6]\\d{7}$ */ //大陆+港澳台 String phone="13100385465";//电话号码 String PHONE= "^[1][3-9]\\d{9}$|^([5|6|9])\\d{7}$|^[0][9]\\d{8}$|^[6]\\d{7}$";//校验规则 //长度判断 if(phone.length()==11||phone.length()==8||phone.length()==10){ Pattern p = Pattern.compile(PHON); Matcher m = p.matcher(phone); if(m.matches()==false){ System.out.println("手机号码不正确"); } } ———————————————— 版权声明:本文为CSDN博主「Hxning.」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/Hxuening/article/details/107186960 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |