过滤手机号的正则

 

  //正则过滤

    NSString *regex = @"^((13[0-9])|(15[^4,\\D])|(18[0,0-9]))\\d{8}$";

    NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];

    BOOL isMatch = [pred evaluateWithObject:@"手机号"];

  //

    if (!isMatch) {

     //非手机号

    }

 

posted on 2016-01-07 14:10  HL丶  阅读(450)  评论(0编辑  收藏  举报

导航