300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 最新的 java-正则表达式判断手机号 支持虚拟运营商170号段

最新的 java-正则表达式判断手机号 支持虚拟运营商170号段

时间:2019-11-16 12:39:24

相关推荐

最新的 java-正则表达式判断手机号 支持虚拟运营商170号段

国家号码段分配如下:

移动:134、135、136、137、138、139、150、151、157(TD)、158、159、187、188、182

联通:130、131、132、152、155、156、185、186

电信:133、153、180、189、177、(1349卫通)

虚拟:170

不多说,贴测试代码,如下:

import java.io.IOException;import java.util.regex.Matcher;import java.util.regex.Pattern;public class ClassPathResource {public static boolean isMobileNO(String mobiles){Pattern p = pile("^((13[0-9])|(15[^4,\\D])|(14[57])|(17[0])|(17[7])|(18[0,0-9]))\\d{8}$");Matcher m = p.matcher(mobiles);System.out.println(m.matches()+"---");return m.matches();}public static void main(String[] args) throws IOException {System.out.println(ClassPathResource.isMobileNO("14738381438"));}}

转载请注明出处:/elsdnwn/article/details/25191055

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。