From: Tor Erik Linnerud Date: 2009-09-12T22:54:02+09:00 Subject: Re: Word Wrapping at n characters Here is an alternative with analysis and comments: http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/ The code looks like this: def wrap_text(txt, col = 80) txt.gsub(/(.{1,#{col}})( +|$\n?)|(.{1,#{col}})/, "\\1\\3\n") end regards, Tor Erik http://tel.jklm.no/ -- Posted via http://www.ruby-forum.com/.