Question: Consider the following code, or any variations upon it:
`string = "www.google.com/test/test.html`
or
`string = "www.stackoverflow.com/test/test.html`

---

How would i make it so i strip out the first part of the URL `www.google.com` JUST to `/test/test.html? This would have to be universal, so if they were to enter ANY website URL it could just get the ending slashes with the directory. I've tried slice!, but i can't find the range i would use for it. Thanks for the help!
I've tried uri, but when i try to gets using that method it automatically refuses the connection from Google and others.

Answer: 
<http://ruby-doc.org/core/classes/URI/Generic.html#M004891>
I just going through ruby. I can get it as an array for you. Here is my thinking...
string=www.google.com/test/test.html
Interested part is /test/test.html
not interested part is www.google.com

.com looks as a separator here to me. Therefore,   

**string=string.split{'.com') #step 1**

This gives an array of size 2.

Result - ["www.google","/test/test.html"]

It is easy to reject the first one because almost all world wide web sites would very likely have www., if not choose your string to start with http:// to be outcasted. This would remove the first part.

 **string.reject do |niv| niv.include?('www.') end #step 2.**

niv is  *not interesting value*  which turns out to be true for the first string in the array and the first string of the array is therefore rejected. Now your string in the array will contain only what you want.

puts string

I think you can easily chop/slice the array also at step 1 to get what you want.

Regards,  

Balaji