From: "Brian Schröder" Date: 2005-07-30T00:33:06+09:00 Subject: Re: Chopping the beginning of a string elegantly On 29/07/05, francisrammeloo@hotmail.com wrote: > Thanks all, > > I eventually used this > > thePane = line.scan(/Begin\w+/)[0].sub(/Begin/, "") > > where line looks like this: > BeginCaption 0, 20, 66, .. > > It looks a little better but still not very elegant. Is it possible to > make it even still shorter? > > Best regards, > Francis > > > line.sub(/^Begin(\w+).*/, '\1') => "Caption" -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/