From: Marek Janukowicz Date: 2003-03-16T19:57:57+09:00 Subject: Re: Can't think On Sun, 16 Mar 2003 19:33:59 +0900, Tim Bates wrote: > I want to do this: > mystring.split("\n").delete_if{ |s| s =~ /^\s*$/ }.join("\n") > using gsub ('cause it'd be nicer). So what I'm doing is removing those lines > that consist of only whitespace. I tried this: > mystring.gsub(/^\s*$/, "") > This removes the whitespace, but not the newline, like the above one does. So > really, the question is how do I get the regexp to match the newline? try mystring.gsub(/\n+/,"").gsub(/\s+/,"\n") -- Marek Janukowicz