Last active
December 16, 2015 20:10
-
-
Save anthonycvella/5490481 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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