Skip to content

Instantly share code, notes, and snippets.

@anthonycvella
Last active December 16, 2015 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anthonycvella/5490481 to your computer and use it in GitHub Desktop.
Save anthonycvella/5490481 to your computer and use it in GitHub Desktop.
- (IBAction)btnConvert:(id)sender {
NSString *urlString = urlField.text;
answerData = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]];
html = [[NSString alloc] initWithData:answerData encoding:NSUTF8StringEncoding];
NSLog(@"Source: %@", html);
NSRegularExpression *regexp = [NSRegularExpression regularExpressionWithPattern:@"((?<=ansMap\\[\\d] = ')|(?<=ansMap\\[\\d\\d] = '))\\w+" options:NSRegularExpressionAnchorsMatchLines error:NULL];
NSArray *numberOfMatches = [regexp matchesInString:html options:0 range:NSMakeRange(0, [html length])];
NSLog(@"ansMap Value: %lu", (unsigned long)numberOfMatches);
for (NSTextCheckingResult* match in numberOfMatches) {
NSRange wordRange = [match rangeAtIndex:1];
NSString* answer = [html substringWithRange:wordRange];
NSLog(@"ansMap Value: %@", answer);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment