From: Phrogz Date: 2007-07-26T08:09:59+09:00 Subject: Re: A method to search and cut in Ruby. On Jul 25, 4:59 pm, scomb...@gmail.com wrote: > For example if I have a file called filename.txt and I want to search > for this ---> "Compression : JPEG (old-style)" > but only return everything to the right of the delimitator? C:\>irb irb(main):001:0> s = "Foo : Bar" => "Foo : Bar" irb(main):002:0> s.split ":" => ["Foo ", " Bar"] irb(main):003:0> s.split(":").last => " Bar" ...or did you want the leading whitespace chomped? irb(main):004:0> s.split( /\s*:\s*/ ) => ["Foo", "Bar"] irb(main):005:0> s.split( /\s*:\s*/ ).last => "Bar"