正则

作者: mayday2024 | 来源:发表于2015-07-17 00:05 被阅读42次
           - (BOOL)urlRegExprWithText:(NSString *)text pattern:(NSString *)pattern{
    
    
    NSRegularExpression *expression = [NSRegularExpression regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive error:nil];
    
    
    NSArray *resultArr = [expression matchesInString:text options:NSMatchingReportCompletion range:NSMakeRange(0, text.length)];
    
    
    if (resultArr.count == 0) {
        return NO;
    }
    
    return YES;
     }

    相关文章

      网友评论

          本文标题:正则

          本文链接:https://www.haomeiwen.com/subject/pccpqttx.html