From: ara.t.howard@... Date: 2006-01-07T13:01:05+09:00 Subject: Re: Splitting strings on spaces, unless inside quotes On Sat, 7 Jan 2006, Tim Heaney wrote: > Richard Livsey writes: > >> I want to split a string into words, but group quoted words together >> such that... >> >> some words "some quoted text" some more words >> >> would get split up into: >> >> ["some", "words", "some quoted text", "some", "more", "words"] > > How about the csv module? Despite the name, you don't have to use > commas. > > require 'csv' > CSV::parse_line('some words "some quoted text" some more words', ' ') > > I hope this helps, briliant! -a -- =============================================================================== | ara [dot] t [dot] howard [at] noaa [dot] gov | all happiness comes from the desire for others to be happy. all misery | comes from the desire for oneself to be happy. | -- bodhicaryavatara ===============================================================================