Gu stav wrote:
> Hi! I'm trying to write a regex that splits up a hostname and returns it
> in a nice array. For example:
>
> "eat.chunky.bacon.com" => regex => ["eat","chunky","bacon","com"]
>
> Been trying to wrap my head around this, but I merely get around to
> catching the top domain ;) Anyone done this recently?
>
> Many thanks!
>   

No need for regex or anything fancy, really...

irb(main):001:0> "eat.chunky.bacon.com".split(".")
=> ["eat", "chunky", "bacon", "com"]


-Justin