From: Tim Heaney Date: 2006-01-07T10:12:59+09:00 Subject: Re: Splitting strings on spaces, unless inside quotes 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, Tim