use Data::Dumper; use strict; sub my_split { local $_ = shift; my $abc; s/(('|").*?\2)/ ($abc = $1) =~ s!\s+!\cA!g; $abc /ge; #!" grep{s/\cA/ /g, $_}split/\s+/; } my @pieces = my_split q/one "two three" four "five six seven" eight/; print Dumper(\@pieces);
In reply to Re: In need of a stupid regex trick
by pg
in thread In need of a stupid regex trick
by 87C751
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |