Parse CSV with embedded quotes on mixed string
<p>I have looked around, but cannot find a tidy working solution to this. I have been trying to use TEXT:CSV_XS so this is not about merely doing something the hard way with a regex. I may not be able to easily install TEXT::CSV, but I do have the XS version.</p>

<p>I simply need to parse into csv fields, which I will later break down into kv pairs. </p>

<pre><code>use Text::CSV_XS;
use Data::Dumper;

my $csv = Text::CSV_XS-&gt;new ({ allow_loose_quotes =&gt; 1, 
                               allow_whitespace =&gt; 1,  
                               eol =&gt; $/ });

my $str3 = '09/11/2016 22:05:00 +0000, search_name="ThreatInjection - Rule", search_now=1473644880.000, search="bunchof|stuff1,bunch%of-stuff2", count=100';

my $status  = $csv-&gt;parse($str3);
my @details = $csv-&gt;fields();
print $csv-&gt;error_diag ();
print Dumper(\@details);
</code></pre>

<p>Resulting output is:</p>

<pre><code>$VAR1 = [
      '09/11/2016 22:05:00 +0000',
      'search_name="ThreatInjection - Rule"',
      'search_now=1473644880.000',
      'search="bunchof|stuff1',
      'bunch%of-stuff2"',
      'count=100'
    ];
</code></pre>

<p>So, the ask is to get search="bunchof|stuff1,bunch%of-stuff2" to remain in one field. I am sure the answer is simple, but, a bit stumped none the less. Any help appreciated.</p>