I am having problems parsing a CSV file. The error exists within a field that separates it's contents with a comma. I have tried almost everything. The Text::CVS_XS module still does not seem solve my problems. I've been trying to find a solution to this problem for days. I would really appreciate help with this.
Example CSV Record:
12345,Jim,,"""Smith, Jr.""",1234 W. Baker Ct., ,Ontario,CA,12345,123456789, ,,27-Apr-02,1234567
Even when using Text::CVS_XS, the "Jr." will be parsed as the address. Should I write a RegEx to substitute the comma with in the triple double quotes to a pipe (|) and then parse the record (only to substitute back to a "," before writing)? If so, I have no clue how to write the RegEx. For the record, I have tried to find answers on this site. I am not having any luck. Please advise.
Thanks in advance for any and all help!!!
CPB
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.