正则表达式--验证中国手机号

工作过程中遇到上传手机通讯录功能,下面把验证中国手机号的正则表达式以及方法贴出来

 1 package com.v1.linxun.sdk.util;
 2 
 3 public class TelUtil {
 4     static String regex = "^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$";
 5     public static boolean validTel(String tel){
 6         boolean flag = tel.matches(regex);
 7         return flag;
 8     }
 9     public static void main(String[] args) {
10         String tel = "13260059310";        
11         System.out.println(validTel(tel));            
12     }
13 
14 }

根据返回值true或者false判断手机号是否符合中国手机号格式

posted @ 2016-01-14 15:34  Mr、Bo  阅读(1426)  评论(0编辑  收藏  举报