...

View Full Version : parse out domain



esthera
08-12-2007, 02: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

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

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

http://msdn2.microsoft.com/en-us/library/ms524602.aspx

esthera
08-13-2007, 02: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)

Spudhead
08-13-2007, 02: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.

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

silverskymedia
01-18-2008, 08: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, 12:26 PM
Sure,

RegExp will help you.

HTH, Tom



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum