From: Jason Mayer Date: 2006-12-13T22:57:34+09:00 Subject: Re: Newbie questions ------=_Part_83753_32299135.1166018252028 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline One way modifying paul's method: data = "blah blah blah blah example: twenty blah blah blah blah" result = data.scan(%r{(example: \w+)}).flatten puts result strip = result.to_s strip.[]=(0,8, "") puts strip.strip Output: C:\ruby\programs>ruby regex3.rb example: twenty twenty Another way: data = "blah blah blah blah example: twenty blah blah blah blah" result = data.scan(%r{(example: \w+)}).flatten puts result strip = result.to_s strip.gsub!(/example: /, "") puts strip Output: C:\ruby\programs>ruby regex3.rb example: twenty twenty Someone else on the list is certainly more qualified than myself to tell you which method is most efficient. On 12/13/06, Dav Jones wrote: > > Oh also...What if I don't want example as part of it? Just what follows. > Would example have to be removed manually afterwards or is there a way > of getting only what follows ( ?: ????) > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_83753_32299135.1166018252028--