<div dir="ltr">One way would be to use a two-step process. On the first pass, strip out the double-quoted components. Then, in the second pass, parse only the components which aren't quoted.<div><br></div><div>So, in your example, the first pass would return an array of three items:</div>
<div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">> component1,</span><span style="font-family:arial,sans-serif;font-size:13px">component2,</span><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">> "This is my, test string"</span><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">> </span><span style="font-family:arial,sans-serif;font-size:13px">, component4</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">The second pass would remove the beginning and trailing commas, and then split what's left at the remaining commas.</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Doug</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 3, 2013 at 4:22 PM, Robert L. Harris <span dir="ltr"><<a href="mailto:robert.l.harris@gmail.com" target="_blank">robert.l.harris@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div>*Sorry for the OT but my only perl lists have gone dark a long time ago*<div><br></div><div>
<br></div><div>$String='component1,component2,"This is my, test string", component4';</div>
<div><br></div><div>($C1, $C2, $Str, $C4) = split(',', $String);</div><div><br></div><div>I'm only getting "This is my" in $Str and $C4 does not contain "component4". Is there a graceful way of handling this? It's a 1 in 10000 chance it'll break but accuracy counts.</div>
<span class="HOEnZb"><font color="#888888">
<div><br></div><div>Robert</div><div><br clear="all"><div><br></div>-- <br>:wq!<br>---------------------------------------------------------------------------<br>Robert L. Harris<br><br>DISCLAIMER:<br> These are MY OPINIONS With Dreams To Be A King,<br>
ALONE. I speak for First One Should Be A Man<br> no-one else. - Manowar
</div></font></span></div>
<br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><br></div>