From: Robert Dober Date: 2007-07-11T06:20:58+09:00 Subject: Re: Help: Efficient regular expression On 7/10/07, James Edward Gray II wrote: > On Jul 10, 2007, at 3:25 PM, Divya Badrinath wrote: > > > Divya Badrinath wrote: > >> string = "root 14051 14033 3 08:39 pts/2 00:00:00 /bin/bash" > >> > >> i need to fetch 14051 and /bin/bash from the string > > > > i mean i need the 2nd column and the last column. > > cols = string.split > sec, last = cols.values_at(1, -1) Very interesting James, I seem to be rather extreme and sec, last = string.split.values_at(1, -1) might be a tad to long for one line in your style, however Ruby syntax just supports this marvelous syntax :) sec, last = string.split. values_at(1, -1) Robert > > Hope that helps. > > James Edward Gray II > > -- I always knew that one day Smalltalk would replace Java. I just didn't know it would be called Ruby -- Kent Beck