[Project_owners] How to find and strip TLDs' from URIs'

HJ bugus at universum.org
Tue Oct 26 23:38:48 EDT 2004


Pete Collins wrote:
> 
>> P.s. mozdevs TLD is .org ;)
>>
> js> var uri = jslibCreateInstance("@mozilla.org/network/simple-uri;1", 
> "nsIURI");
> js> uri.spec="http://www.mozdev.org/";
> http://www.mozdev.org/
> js> uri.path;
> //www.mozdev.org/
> js> uri = uri.path.replace(/\//g, "");
> www.mozdev.org
> js> uri = uri.substring(uri.lastIndexOf("."), uri.length);
> .org
> js>
> 

Thanks Pete.

Now I have to find a way to strip one or more of the 249 country code 
and other external entities TLDccs' like .co.uk

/HJ


More information about the Project_owners mailing list