国家号码段分配如下:
移动: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