简体   繁体   中英

Print regex results objective-C

I have this regex method

NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSString *regexStr = @"(<\/b>[A-F][+| |-]|<\/b>[A-F][+| |-] \(\d\d\.\d%\))";
NSError *error = nil;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:regexStr options:0 error:&error];

NSArray *matches = [regex matchesInString:string options:0 range:(NSRange){0, [string length]}];

for (NSTextCheckingResult *item in matches) {
    NSLog(@"%@", item);
}

But my output is of the form:

2014-04-08 02:27:27.710 MistarApp[11540:60b] <NSSimpleRegularExpressionCheckingResult: 0x1093f18a0>{8379, 6}{<NSRegularExpression: 0x1093f1470> (</b>[A-F][+| |-]|</b>[A-F][+| |-] (dd.d%)) 0x0}

And after like 4 or 5 of those, it fails and gets a SIGABRT . What do I log instead??

There was a pretty significant error with the compiler. I deleted and recreated the project, that fixed the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM