<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Comments on snippet: 'Regex (regular expression) to match a URL'</title>
<link>http://snipplr.com</link>
<description>Snipplr comments feed'</description>
<language>en-us</language>
<pubDate>Tue, 14 Feb 2012 07:22:45 GMT</pubDate>
<item>
<title>keevkilla said on 7/12/10</title>
<link>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</link>
<description><![CDATA[ Last (but not least) change of snippet location :
http://snipplr.com/view/36992/improvement-of-url-interpretation-with-regex/ ]]></description>
<pubDate>Mon, 12 Jul 2010 16:11:40 GMT</pubDate>
<guid>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</guid>
</item>
<item>
<title>keevkilla said on 7/9/10</title>
<link>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</link>
<description><![CDATA[ Well it also removes the underscores...
So I posted my contribution here :
http://snipplr.com/view/36991/improvement-of-url-interpretation-with-regex/ ]]></description>
<pubDate>Fri, 09 Jul 2010 09:43:51 GMT</pubDate>
<guid>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</guid>
</item>
<item>
<title>keevkilla said on 7/9/10</title>
<link>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</link>
<description><![CDATA[ just replace the regex by '@((https?://)?(\w+.[-\w.]+)+\w(:\d+)?(/([-\w/.](\?\S+)?)?))@' because in my last post, some characters are missing because of misinterpretation... ]]></description>
<pubDate>Fri, 09 Jul 2010 09:36:20 GMT</pubDate>
<guid>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</guid>
</item>
<item>
<title>keevkilla said on 7/9/10</title>
<link>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</link>
<description><![CDATA[ I improved the regex given here, to take into account your comments :
preg_replace('@((https?://)?(\w+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@', '<a href="$1">$1</a>', $text);

Now with this regex, the links can be without any http:// or https:// block (like www.exemple.com) and can have multiple /folder/subfolder/file.htm after the domain, and finally "-" are considered as part as a standard URL.

Thanks for the first regex that helped me a lot find this one ! I hope mine will help the others. ]]></description>
<pubDate>Fri, 09 Jul 2010 09:34:58 GMT</pubDate>
<guid>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</guid>
</item>
<item>
<title>chicagowebdeveloper said on 3/30/10</title>
<link>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</link>
<description><![CDATA[ Does this work with links that do not have the "http" or "https" in front of it. like ubuntu.com for example? ]]></description>
<pubDate>Tue, 30 Mar 2010 14:25:24 GMT</pubDate>
<guid>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</guid>
</item>
<item>
<title>joshOiknine said on 1/14/10</title>
<link>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</link>
<description><![CDATA[ Took me a few min to track this down on Google but it was exactly what I was looking for.  Thank You. ]]></description>
<pubDate>Thu, 14 Jan 2010 22:40:47 GMT</pubDate>
<guid>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</guid>
</item>
<item>
<title>tannerc said on 12/18/09</title>
<link>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</link>
<description><![CDATA[ Perfect! I spent the better part of this morning looking for a great URL matching snippet and finally found it here. Thank you! ]]></description>
<pubDate>Fri, 18 Dec 2009 14:49:33 GMT</pubDate>
<guid>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</guid>
</item>
<item>
<title>inhahe said on 11/28/09</title>
<link>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</link>
<description><![CDATA[ it's also missing left parenthesis, right parenthesis, and comma. ]]></description>
<pubDate>Sat, 28 Nov 2009 04:11:41 GMT</pubDate>
<guid>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</guid>
</item>
<item>
<title>goozak said on 11/10/09</title>
<link>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</link>
<description><![CDATA[ Great regex, thanks !  Small thing : the '-' (dash) is missing - URL like this fails (http://web5.uottawa.ca/admingov/reglements-methodes.html) ]]></description>
<pubDate>Tue, 10 Nov 2009 14:49:00 GMT</pubDate>
<guid>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</guid>
</item>
<item>
<title>goozak said on 11/10/09</title>
<link>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</link>
<description><![CDATA[ Great regex, thanks !  Small thing : the '-' (dash) is missing - URL like this fails (http://web5.uottawa.ca/admingov/reglements-methodes.html) ]]></description>
<pubDate>Tue, 10 Nov 2009 14:47:12 GMT</pubDate>
<guid>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</guid>
</item>
<item>
<title>cjastram said on 10/21/09</title>
<link>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</link>
<description><![CDATA[ Perfect for copy-and-paste.  Very nice regex, thank you! -cej102937 ]]></description>
<pubDate>Wed, 21 Oct 2009 11:15:54 GMT</pubDate>
<guid>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</guid>
</item>
<item>
<title>jpo said on 9/1/09</title>
<link>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</link>
<description><![CDATA[ Perfect.  Thank you! ]]></description>
<pubDate>Tue, 01 Sep 2009 10:39:42 GMT</pubDate>
<guid>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</guid>
</item>
<item>
<title>hathrill said on 8/20/09</title>
<link>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</link>
<description><![CDATA[ Exactly what I needed. I heart you. ]]></description>
<pubDate>Thu, 20 Aug 2009 11:31:52 GMT</pubDate>
<guid>http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</guid>
</item>
</channel>
</rss>
