From: Divya Badrinath Date: 2007-07-11T05:39:18+09:00 Subject: Re: Help: Efficient regular expression Florian A��mann wrote: > Hi Divya, use > > string[/\s(\d+)/, 1] > > see String.[] > > Regards > Florian string = "root 14051 14033 3 08:39 pts/2 00:00:00 /bin/bash" with this, string =~ /(\d+)\s+(\d+)\s+\d+\s+\d+:\d+\s+.*\s+\d+:\d+:\d+\s+(.*)\s/ $1 gives me 14051 and $3 gives me /bin/bash what i am trying to do is to get $1 and $3 into a hash. -- Posted via http://www.ruby-forum.com/.