From: "David A. Black" Date: 2009-02-07T03:35:54+09:00 Subject: Re: regex \s == \n??? --1926193751-1272711720-1233945397=:18614 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-1272711720-1233945397=:18614" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-1272711720-1233945397=:18614 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Hi -- On Sat, 7 Feb 2009, Mark Thomas wrote: > On Feb 6, 9:37�am, Julian Leviston wrote: >> Can't you use squeeze? > > Best idea yet. Might as well use a built-in, rather than reinventing > one. > > a.squeeze(" ") See my earlier post in this thread. squeeze is a good candidate as long as you don't mind preserving all non-" " whitespace, including tabs. (squeeze defaults to " " as its argument, so you don't have to provide an argument unless it's something different.) David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2) http://www.wishsight.com => Independent, social wishlist management! --1926193751-1272711720-1233945397=:18614-- --1926193751-1272711720-1233945397=:18614--