ruby - How to get domain from URL without using URI Parser. I want to done it using regex -
i'm trying write regular expression returns domain url. example:-
"http://github.com" # => 'github'
i'd go @arup rakshit's solution. if want regexp, why not using
/^http:\/\/(.+)\.[a-z]{2,3}/
Comments
Post a Comment