in reply to In need of a stupid regex trick
And the output is -use strict; use warnings; use Data::Dumper; my $str = 'one "two three" four five "six seven eight" nine'; my @words = map { $_ || () } split /"(\\"|.*?)"|\s+/, $str; print Dumper(\@words);
$VAR1 = [ 'one', 'two three', 'four', 'five', 'six seven eight', 'nine' ];
|
|---|