View Full Version : parse out domain

08-12-2007, 01:40 PM
how can i easily parse out a domain from a string

meaining if i take in a string http://www.xxx.com/mytestpage.html
it will always return just the www.xxx.com without the rest of it

08-13-2007, 01:47 PM
response.write Request.ServerVariables("SERVER_NAME")

Here are the rest of the Request objects for you to look through:


08-13-2007, 01:53 PM
I don't want the server variables -- I want to parse it out of a string (i'm actually taking it from referrer)

08-13-2007, 01:56 PM
Well if you split the full URL on "//", and then split the remainder on "/", you're going to end up with the domain as the first element in your new array.

08-13-2007, 06:29 PM
have a look here (http://classicasp.aspfaq.com/general/how-do-i-parse-the-domain-name-out-of-a-url.html)

01-18-2008, 07:24 AM
what if I wanted to take "http://localhost/portfolio/attics/default.asp" and strip out "http://localhost/portfolio/". Is that possible?

Whatever Jr.
01-18-2008, 11:26 AM

RegExp will help you.

HTH, Tom

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum