From: James Edward Gray II Date: 2006-12-03T14:27:24+09:00 Subject: Re: comma separating output from array.to_s On Dec 2, 2006, at 10:25 PM, William James wrote: > x =~ /["\n]|^\s|\s$/ What is that regex doing? Quoting any field with a quote or a newline, in addition to any field beginning or ending with whitespace? That fails on a field containing a comma. Carriage returns also need to be escaped in CSV. I have no idea what the whitespace tricks are for either. A better test is: x.count(%Q{\r\n,"}).nonzero? James Edward Gray II