I\'m using the following code on my iPhone app, taken from here to extract all URLs from striped .html code.
I\'m only being able to extract the first URL, but I nee
I found myself so nauseated by the complexity of this simple operation ("match ALL the substrings") that I made a little library I am humbly calling Unsuck which adds some sanity to NSRegularExpression in the form of from and allMatches methods. Here's how you'd use them:
NSRegularExpression *re = [NSRegularExpression from: @"(?i)\\b(https?://.*)\\b"]; // or whatever your favorite regex is; Hossam's seems pretty good
NSArray *matches = [re allMatches:httpLine];
Please check out the unsuck source code on github and tell me all the things I did wrong :-)
Note that (?i) makes it case insensitive so you don't need to specify NSRegularExpressionCaseInsensitive.