The comma separated data is entered by a user and I want to keep it as simple as possible, so extra quoting is something I want to avoid.

Ok, I see, although there are of course other alternatives. Like for example, it may not be so difficult on the user if you require all fields to be quoted, that's one less rule for the user to remember. In the end, it'll be up to you to decide what is easiest for the user and for the implementation. I agree with AnomalousMonk's point that doubling up the commas leads to ambiguity, so if you really don't like the quoting, perhaps the backslashes are not such a bad idea (and the only issue was really the misunderstandings about the format); the parser I showed here has some pretty simple rules: commas are field separators, backslashes and commas can be escaped with backslashes, plus the support for the \x... sequence.


In reply to Re^5: Regex with Backslashes by haukex
in thread Regex with Backslashes by anita2R

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.