iOS 手机号正则验证

/**

  • 是否为有效的手机号码
  • @return 是否有效
    */
  • (BOOL)checkIsValidPhoneWithPhone:(NSString *)phone{
    NSString *pattern = @"^1+[34578]+\d{9}";
    NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", pattern];
    BOOL isMatch = [pred evaluateWithObject:phone];
    return isMatch;
    }

你可能感兴趣的:(iOS 手机号正则验证)