$s='"crosby","stills","nash",""and" ""sometimes"" "young""' # capture everything between a quote and a quote # follow by a comma or the end of string $s =~ s[ " (.*?) " ( , | $ ) ] { # Look for unescaped embedded quotes and escape them (my $t = $1) =~ s[ (?