regex和ios5 stringByMatching ==> NSRegularExpression

JHT*_*JHT 4 regex ios5

如何使用等效的NSRegularExpression更改此行

NSString* encodedPoints = [apiResponse stringByMatching:@"points:\\\"([^\\\"]*)\\\"" capture:1L];
Run Code Online (Sandbox Code Playgroud)

谢谢

Adr*_*eli 12

请记住,您需要iOS 4.0或更高版本才能使用此功能:

NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"points:\\\"([^\\\"]*)\\\"" options:0 error:NULL];
NSTextCheckingResult *match = [regex firstMatchInString:apiResponse options:0 range:NSMakeRange(0, [apiResponse length])];
NSString *encodedPoints = [apiResponse substringWithRange:[match rangeAtIndex:1]];
Run Code Online (Sandbox Code Playgroud)

希望能帮助到你.