- (BOOL) isPhoneNum:(NSString*)str{

  //新匹配166,199,198开头手机号码

    NSError *error = NULL;

    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^(((13[0-9])|(14[579])|(15([0-3]|[5-9]))|(16[6])|(17[0135678])|(18[0-9])|(19[89]))\\d{8})$" options:NSRegularExpressionCaseInsensitive error:&error];

    NSTextCheckingResult *result = [regex firstMatchInString:str options:0 range:NSMakeRange(0, [str length])];

    

    

    if (result) {

        return YES;

    }

    return NO;

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-02-04
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-08
  • 2022-01-31
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
相关资源
相似解决方案