I'm trying to remove extra spaces from a long string which has some 
EOLs, using regex. It's not working. Here's a simple demo:

irb(main):004:0> a="\n  abc\n  a  a  a"
=> "\n  abc\n  a  a  a"
irb(main):005:0> a.gsub(/\s+/,' ')
=> " abc a a a"

I've dug around in my regex references, and all I can say is that is 
hasn't been the least bit helpful. I'm probably not looking for the 
right thing.

Can someone more knowledgeable tell me is there's a way to do this - 
remove extra spaces without removing the EOLs?

Thanks!

t.

-- 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc / tomcloyd.com >> (email)
<< TomCloyd.com >> (website) 
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~