From: Gavin Kistner Date: 2005-09-14T23:48:36+09:00 Subject: Re: Quick and dirty word wrapping. --Apple-Mail-1-225733389 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Sep 14, 2005, at 8:38 AM, James Edward Gray II wrote: >> str.scan(/(.{1,30})(?:\s+|$)/) > I'm still puzzling out how that works... Up to 30 characters, but there has to be whitespace after it (to keep it from splitting in the middle of the word) or be the very end of the string. The greedy regexp will grab all 30 if it can find them with whitespace after, otherwise it will backtrack until it finds the right spot. Very nice, Erik. I like how it also strips the whitespace that will be wrapped. --Apple-Mail-1-225733389--