 <p>Use a regex: <a href="http://regexkit.sourceforge.net/RegexKitLite/index.html" rel="nofollow noreferrer">RegexKitLite</a></p> <p>Here's a complete example using the <a href="http://regexkit.sourceforge.net/RegexKitLite/index.html#RegexKitLiteCookbook_PatternMatchingRecipes_NetworkandURL" rel="nofollow noreferrer">HTTP matching URL from the RegexKitLite documentation</a>. The RegexKitLite <code>-componentsMatchedByRegex:</code> method will return a <code>NSArray</code> of all the URL matches it finds in the string.</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; #import "RegexKitLite.h" int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSString *stringToSearch = @"&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n" @"&lt;rsp stat=\"ok\"&gt;\n" @" &lt;mediaid&gt;y2q62&lt;/mediaid&gt;\n" @" &lt;mediaurl&gt;http://twitpic.com/url&lt;/mediaurl&gt;\n" @"&lt;/rsp&gt;\n"; NSString *urlRegex = @"\\bhttps?://[a-zA-Z0-9\\-.]+(?:(?:/[a-zA-Z0-9\\-._?,'+\\&amp;%$=~*!():@\\\\]*)+)?"; NSArray *matchedURLsArray = [stringToSearch componentsMatchedByRegex:urlRegex]; NSLog(@"matchedURLsArray: %@", matchedURLsArray); [pool release]; pool = NULL; return(0); } </code></pre> <p>Compile and run with:</p> <pre><code>shell% gcc -arch i386 -o url url.m RegexKitLite.m -framework Foundation -licucore shell% ./url 2010-01-14 16:05:32.874 url[71582:903] matchedURLsArray: ( "http://twitpic.com/url" ) </code></pre>