HI,
I have a NSString that cotains a lot of text. Inside the text is a iTunes URL. The URL is masked with BBCode. How can I extract the plain URL?
Sorry, but my regex skills are really bad.
The text:
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At ver [itunes link="http://www.example.tld/redirect.php?url=http%3A%2F%2Fitunes.apple.com%2Fde%2Fapp%2Fbaby-monitor-alarm%2Fid331519989%3Fmt%3D8%26uo%3D4" title="Babyphon"] Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At ver
My First Try:
NSString *regEx = @"(link=?).*";
NSString *match = [myText stringByMatching:regEx];
if ([match isEqual:@""] == NO) {
NSLog(@"Match Ituneslink; %@", match);
}
else
{
NSLog(@"Not found.");
}
The result:
link="http://www.appsnight.tv/redirect.php?url=http%3A%2F%2Fitunes.apple.com%2Fde%2Fapp%2Fmare-fernweh%2Fid379051618%3Fmt%3D8%26uo%3D4" title="Mare"]
It takes too much, I need only the itunes link :-(