Kevin Stolt wrote: > Hi, > > I am new to ruby and I have been search and pulling my hair to do this > using .scan? > > I have file which contains.....(this is an example) > > bat rat cat mat pat > mat sat put tomorrow today > > > So how could I search so I could get the values in the second column? > > I want to find "rat" and "sat" for example. I searched many time and > read many things but I can't figure out. I hope someone would be kind > enough to help me or show me the correct direction. > > any help is appreciated. > > thanks in advance > kev I don't know what you want but the following might show you some clues: C:\>irb irb(main):001:0> line='bat rat cat mat pat' => "bat rat cat mat pat" irb(main):002:0> re=Regexp.new('rat') #create a regular expression abject => /rat/ irb(main):004:0> puts re.match(line) # match the regexp against the string rat => nil Li -- Posted via http://www.ruby-forum.com/.