java手机号码、电子邮箱校验

/**

  • 手机号:目前全国有27种手机号段。
  • 移动有16个号段:134、135、136、137、138、139、147、150、151、152、157、158、159、182、187、188。其中147、157、188是3G号段,其他都是2G号段。
  • 联通有7种号段:130、131、132、155、156、185、186。其中186是3G(WCDMA)号段,其余为2G号段。
  • 电信有4个号段:133、153、180、189。其中189是3G号段(CDMA2000),133号段主要用作无线网卡号。
  • 150、151、152、153、155、156、157、158、159 九个;
  • 130、131、132、133、134、135、136、137、138、139 十个;
  • 180、182、185、186、187、188、189 七个;
  • 13、15、18三个号段共30个号段,154、181、183、184暂时没有,加上147共27个。
    */
    private boolean telCheck(String tel){
    Pattern p = Pattern.compile("^(13\d{9}\()|(15[0,1,2,3,5,6,7,8,9]\\d{8}\))|(18[0,2,5,6,7,8,9]\d{8}\()|(147\\d{8})\))");
    Matcher m = p.matcher(tel);
    return m.matches();

电子邮箱:reg=/^(\w)+(.\w+)*@(\w)+((.\w+)+)$/

posted @ 2017-11-11 22:55  再见、梦想  阅读(2531)  评论(0编辑  收藏  举报