<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Comments on snippet: 'Extract domain name with RegExp'</title>
    <description>Snipplr comments feed</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Sun, 05 Apr 2026 17:16:00 +0000</lastBuildDate>
    <item>
      <title>burnandbass said on 11/Apr/2011</title>
      <link>https://snipplr.com/view/51619/extract-domain-name-with-regexp</link>
      <description>&lt;p&gt;static private const URL_REGEXP:RegExp = /(https?:\/\/[-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?/&#13;
&#13;
&#13;
static public function getHost(url:String):String {&#13;
			var results:Array = url.match(URL_REGEXP);&#13;
			return results ? url.match(URL_REGEXP)[1] : null;&#13;
		}		&#13;
		&#13;
		public static function decode(s:String):String {&#13;
			return unescape(s.replace(/\+/g, ' '))&#13;
		}	&#13;
&#13;
I use this functions to extract the URL and make all relative paths to absolute (sometimes I need to)&lt;/p&gt;</description>
      <pubDate>Mon, 11 Apr 2011 02:23:52 UTC</pubDate>
      <guid>https://snipplr.com/view/51619/extract-domain-name-with-regexp</guid>
    </item>
  </channel>
</rss>
