Skip to content

Instantly share code, notes, and snippets.

@pjaspers
Created January 6, 2011 15:48
Show Gist options
  • Save pjaspers/768044 to your computer and use it in GitHub Desktop.
Save pjaspers/768044 to your computer and use it in GitHub Desktop.
- (void)liveRequest:(ASIHTTPRequest *)request didReceiveData:(NSData *)data {
NSString *aString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSError *error = nil;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(\\{.*?\\})"options:NSRegularExpressionCaseInsensitive error:&error];
[regex enumerateMatchesInString:aString options:0 range:NSMakeRange(0, [aString length]) usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop){
//DLog(@"Our Range %@", NSStringFromRange(match.range));
//DLog(@"Text %@", [aString substringWithRange:match.range]);
[Parser parserWithResponse:[aString substringWithRange:match.range] delegate:self andRequest:request];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment