use strict;
use warnings;
use feature 'say';
# use Regexp::Common;
# ^^^ Not used. I'm so lazy, I just peeked at $RE{quoted}
# to construct the "$quoted" expression below, by slightly
# modifying it (see "$") to satisfy the third clause.
# And actually 2nd test case below is to test how it works,
# it seems there's not a similar one among your 18.
my $quoted = qr/
(?:(?|
(?:(?##
my $quoted = qr/
(?:(?|
(?:\")(?:[^\\\"]*(?:\\.[^\\\"]*)*)(?:\"|$)|
(?:\')(?:[^\\\']*(?:\\.[^\\\']*)*)(?:\'|$)
))
/x;
my $re = qr/
(?:
(?:\\\\)+
|
(?:\\[^ ])
|
$quoted
|
[^ ]
)+ \K
(?:
\ | $
)
/x;
##
##
my $quoted = qr/
(?:(?|
(?:
(?:[^\\\'\ ]*(?:\\[^\ ][^\\\'\ ]*)*)
\"
)
(?:
[^\\\"]*
(?:
\\
.
[^\\\"]*
)*
)
(?:\"|$)
|
(?:(?:[^\\\' ]*(?:\\[^ ][^\\\' ]*)*)\')(?:[^\\\']*(?:\\.[^\\\']*)*)(?:\'|$)
))
/x;
##
##
my $quoted = qr/
(?:(?|
(?:\")(?:[^\\\"]*(?:\\.[^\\\"]*)*)(?:\"|$)
|
(?:\')(?:[^\\\']*(?:\\.[^\\\']*)*)(?:\'|$)
))
/x;
my $re = qr/
(?:
(?:\\.)+
|
$quoted
|
[^ \\"']+
)* \K
(?:
\ | $
)+
/x;
# and later:
my $got = [ split $re, $str ];