判断是否是网络连接url

// 是否是网络连接url
- (BOOL)isInternetLink:(NSString *)linkOrPath
{
    NSString * regexStr =@"http(s)?://([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?";
    if (!linkOrPath) {
        return NO;
    }
    NSPredicate *strPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regexStr];
    return [strPredicate evaluateWithObject:linkOrPath];
}

编程技巧