KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Possible Duplicate: Ruby code to extract host from URL string I found this module called URI which can parse the url. (I'm pretty new to ruby. Is 'module' synonymous with 'library' in this case?) You can then extract the host name. uri = URI.parse("http://www.ruby-lang.org/") ... p uri.host # => "www.ruby-lang.org" From this, I suppose you could remove 'www.' and keep other subdomains using regular expressions. Does anyone have a more straight-forward alternative or does this approach seem right?
Tags (comma-separated)
Save Edits
Cancel