in reply to Another for those who love the Regular Expression questions...
For the record, I know this won't catch escaped quotes, but.. it solves the problem at hand.
I did this just to show that a quick hack is possible, even in a one liner... I love map.
Enjoy!my $string = q|Are "Perl Monks" required to swear an "Oath of Celibacy +?"|; my @broken = map { /"([^"]+)"/ ? $1 : split } split /\s?([^"]+")\s?/, + $string; print "[$_] $broken[$_]\n" foreach 0 .. $#broken;
-- Casey
|
---|
Replies are listed 'Best First'. | |
---|---|
A reply falls below the community's threshold of quality. You may see it by logging in. |
In Section
Seekers of Perl Wisdom