From: "Berger, Daniel" Date: 2006-04-18T00:57:35+09:00 Subject: Re: Regular expression to parse out "host" part of URL string > -----Original Message----- > From: list-bounce@example.com > [mailto:list-bounce@example.com] On Behalf Of Wes Gamble > Sent: Monday, April 17, 2006 9:39 AM > To: ruby-talk ML > Subject: Regular expression to parse out "host" part of URL string > > > All, > > I am trying to write a regex to parse out the "host" part of > a potential > URL. require 'uri' URI.parse('http://www.cnn.com').host # www.cnn.com URI.parse('http://www.cnn.com/').host # www.cnn.com URI.parse('http://www.cnn.com/some/other/stuff').host # www.cnn.com You'll have to prepend the 'http://' yourself. Regards, Dan