From: Charles Mills Date: 2004-07-14T23:56:27+09:00 Subject: Re: Split quoted text On Jul 14, 2004, at 5:51 AM, Michael Weller wrote: > David A. Black wrote: > >> Hi -- >> >> On Wed, 14 Jul 2004, Michael Weller wrote: >> >> >>> My input would be something like "\this is\" \"my text\"" and I want >>> to have an array containing ["\"this is\"", "\"my text\""]. >>> I know it can't be that hard, but ... >>> >> >> p '"this is" "my text"'.scan(/"[^"]+"/) >> # => ["\"this is\"", "\"my text\""] On that note, if you have escaped quotes you can use the following: p '"he said \"hello\"" "field"'.scan(/"(?:\\.|[^"])*?"/) # => ["\"he said \\\"hello\\\"\"", "\"field\""] >> >> >> David >> >> > Yes, I think that's exactly what I searched... Thanks a lot! > > Michael >