------ art_33030_13705474.1189729210835 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 9/14/07, Kenosis <kenosis / gmail.com> wrote: > > Running split on this string, of course, yeilds: > > ['foo', 'bar', '"baz', '42"', '"matz', 'ruby', 'yarv"', 'jruby'] > > What I'd like instead is a "split" that respects the quoted word > groupings, which would result in the following instead: > > ['foo', 'bar', 'baz 42', 'matz ruby yarv', 'jruby'] > > Thanks in advance for any ideas you can lend! Not sure if this is the best way, but just doing this off the cuff and it works: scan(/\w+|\".+?\"/) Regards, Peter Cooper http://www.rubyinside.com/ ------ art_33030_13705474.1189729210835--