> Objective C: how to return the matches an NSRegularExpression finds in the form of a string?

Objective C: how to return the matches an NSRegularExpression finds in the form of a string?

Posted at: 2014-12-18 
I'm working on an RSS feed app for the iPhone, and I'm running into trouble with the images embedded in the feed. They're massive and they take forever to download into the app, so I'm trying to cut down the size of the image by finding all of the URL's to the images in the article with an NSRegularExpression. I've got a working regular expression, but right now I've got it set to just replace the matches it finds with an empty string, but what I want to do is take the matches the regular expression finds and do something like this:

//Find and resize images



NSString *picFind =

UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:picFind]]];

UIImageView *imageView = [[UIImageView alloc] initWithImage:image];



//set contentMode to scale aspect to fit

imageView.contentMode = UIViewContentModeScaleAspectFit;

Is this possible? I'm pretty new to app development, so an explanation would be awesome. Thanks in advance!