From: Divya Badrinath Date: 2007-07-11T05:25:46+09:00 Subject: Re: Help: Efficient regular expression 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. > > can someone help me to write an efficient regular expression for that. > > i am a beginner, i wrote > string =~ /(\d+)\s+(\d+)\s+\d+\s+\d+:\d+\s+.*\s+\d+:\d+:\d+\s+(.*)\s/ > > i know this is not the efficient way of doing it. > > Please help. -- Posted via http://www.ruby-forum.com/.