Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
- (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
You can’t perform that action at this time.