From: Joel VanderWerf Date: 2002-08-29T06:24:54+09:00 Subject: Re: Newbie converting brain from perl William Pietri wrote: ... > In Ruby the best I've been able to do is this: > > date = "28 Aug 2002" > day, month, year = /(\d+) (\w+) (\d+)/.match(date)[1..3] How about: day, month, year = /(\d+) (\w+) (\d+)/.match(date)[1..-1] or _, day, month, year = /(\d+) (\w+) (\d+)/.match(date).to_a Still not quite elegant, but at least the 3 isn't hard-coded. > > But that final [1..3] thing seems inelegant, which makes me think I'm > barking up the wrong tree. What's the best Ruby-style way to do this?