NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(\\[(\\d{2}):(\\d{2})\\.(\\d{2})\\])+(.+)" options:NSRegularExpressionAllowCommentsAndWhitespace error:&error];
[regex enumerateMatchesInString:self options:NSMatchingReportProgress range:NSMakeRange(0, [self length]) usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop){
[*lyricObject addObject:[self substringWithRange:[match rangeAtIndex:5]]];
NSLog(@"%@",[self substringWithRange:[match rangeAtIndex:1]]);
[*stamp addObject:[NSString stringWithFormat:@"%d", ([[self substringWithRange:[match rangeAtIndex:2]] intValue] * 60 + [[self substringWithRange:[match rangeAtIndex:3]] intValue] ) * 100 + [[self substringWithRange:[match rangeAtIndex:4]] intValue]]];
}];
入力文字列 (self) の上のコードのように:
[04:30.50]There are pepole dying
[04:32.50]If you care enough for the living
[04:35.50]Make a better place for you and for me
[04:51.50][04:45.50][04:43.50][04:39.50]You and for me
for グループを取得したいのです[04:51.50][04:45.50][04:43.50][04:39.50]
が、最後の on しか取得できません[04:39.50]
検索NSRegularExpression
すると最後のグループしか取得できない(($1)($2)($3)){2}