From: Lou Vanek Date: 2006-03-13T22:46:30+09:00 Subject: Re: word_wrap method for String? everthing old is new again. you might also want to compare speeds. Yours might be faster. -lv Jeff Coleman wrote: > Lou Vanek wrote: > >>here's a (partially modded) excerpt from a previous discussion on this >>topic: >> >>width = 11 >>str = 'This is a test of the emergency broadcasting servicings I >>asseverate' >>p str.scan(/\S.{0,#{width}}\S(?=\s|$)|\S+/) > > > When I was writing that I just KNEW there must be some one-line solution > involving regular expressions! > > Although I don't quite follow the exact structure of this one, it > definitely works... > > Jeff >