On Thursday 21 August 2003 13:23, dblack / superlink.net wrote:

> Something like this (tweaked as needed) should work:
>
>   irb(main):006:0> str
>   => "\"Guido van Rossum\", \"Larry Wall\", \"Matz\""
>   irb(main):007:0> str.scan(/".+?"/)
>   => ["\"Guido van Rossum\"", "\"Larry Wall\"", "\"Matz\""]

Harry asked for support for \"s inside strings as well. For that a bit 
more of work is needed:

    test = '>>"Guido", "Larry", "Matz", "foo \"bar\""<<'
    puts test.scan(/"(?:\\.|[^"\\])*"/)

gives

    "Guido"
    "Larry"
    "Matz"
    "foo \"bar\""

A post-process of the result would unescape those \" easily if wanted.

-- fxn