NSError *error;
NSRegularExpression *attachmentExpression = [NSRegularExpression regularExpressionWithPattern:@"(\\d*)" options:NSRegularExpressionCaseInsensitive error:&error];
NSArray *matches = [attachmentExpression matchesInString:result
options:0
range:NSMakeRange(0, [result length])];
for (NSTextCheckingResult *match in matches) {
//NSRange matchRange = [match range];
NSRange matchRange = [match rangeAtIndex:1];
NSString *matchString = [result substringWithRange:matchRange];
NSLog(@"%@", matchString);
}
网友评论