dumaloo
asked on
Parse URL with VBScript
I have a URL such as http://www.mydomain.com/Bob.Jones on my Windows server.
I would like to parse out the "Bob" and "Jones" separately so I can use them on a web page.
How can I accomplish this?
I would like to parse out the "Bob" and "Jones" separately so I can use them on a web page.
How can I accomplish this?
ASKER
Thanks rg20. So how do I actually write out the values to the web page with vbscript?
ASKER
So in the browser address bar, I have the following: http://www.mydomain.com/Bob.Jones
My vbscript code is as follows:
myURL = Request.ServerVariables("Q uery_Strin g")
myURL = UCase(Mid(myURL, InStrRev(myURL, "/") + 1, Len(myURL)))
myDomain="http://www.mydomain.com/"
myNewURL=myDomain+myURL
response.write myNewURL ---->> returns http://www.mydomain.com/Bob.Jones
The array should return "Bob" and "Jones" separately. How can I write these two different values to the page?
The code errors out when I include the array stuff above.
Thanks!
My vbscript code is as follows:
myURL = Request.ServerVariables("Q
myURL = UCase(Mid(myURL, InStrRev(myURL, "/") + 1, Len(myURL)))
myDomain="http://www.mydomain.com/"
myNewURL=myDomain+myURL
response.write myNewURL ---->> returns http://www.mydomain.com/Bob.Jones
The array should return "Bob" and "Jones" separately. How can I write these two different values to the page?
The code errors out when I include the array stuff above.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works now! Thanks
You should accept an answer and not just close the question, I done this on accident a few times
ASKER
This helped me arrive at the final solution.
Just curious what were you trying to write out, if they were attached to the URL, and you were spllitting them from the URL, how did it help you get to only a partial answer?
array = split(url,".com/")
This will give you a 2 dimention array
http://www.mydomain
and
Bob.Jones
WordArray = Split(array(2), ".")
will give you
wordarray(0) = Bob
wordarray(1) = Jones