0
:아이폰 OS NSRegularExpression (. *) HEAD를 TAIL 예
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"hello: (.*)ABC" options:0 error:NULL];
NSString *str = @"hello: bobABC123ABC";
NSTextCheckingResult *match = [regex firstMatchInString:str options:0 range:NSMakeRange(0, [str length])];
NSLog(@"macthing part is %@", [str substringWithRange:[match rangeAtIndex:0]]);
매칭의 결과가 "bobABC123ABC"이므로, "ABC"의 정합 NSRegularExpression에서 첫 번째 대신 문자열에서 마지막 "ABC"를 찾습니다. 일치를 "밥"으로 지정하고 싶다면, 어느 누구도이를 달성하는 방법을 알고 있습니까?
_bob_ 또는 _bobABC_? –
마지막 "ABC"대신 첫 번째 "ABC"와 일치 –