in reply to In need of a stupid regex trick

I don't know about a regex, but Text::CSV_XS can do it:

use strict; use Text::CSV_XS; use Data::Dumper; my $csv = Text::CSV_XS->new({sep_char=>' '}); $csv->parse('one "two three" four five "six seven eight" nine'); my @columns = $csv->fields(); print Dumper(@columns);

The result is:

$VAR1 = 'one'; $VAR2 = 'two three'; $VAR3 = 'four'; $VAR4 = 'five'; $VAR5 = 'six seven eight'; $VAR6 = 'nine';

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law