From: David Vallner Date: 2005-07-30T05:14:04+09:00 Subject: Re: Chopping the beginning of a string elegantly William James wrote: >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? >> >> > >line[/Begin(\w+)/]; thePane = $1 > > > > thePane = line.sub(/Begin/, "") should work. Look, mom, nothing gets clobbered in place, no magic globals are used. Just my 2 cents... David (as likkle a newbie as they get)