Use Text::xSV - it was designed for dealing with this kind of situation.
Being right, does not endow the right to be rude; politeness costs nothing. Being unknowing, is not the same as being stupid. Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence. Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
| [reply] |
Use Text::CSV_XS, with binary=>1 and it will handle your CSV much faster and cleaner than any regex you can come up with. | [reply] |
My regex skills are not so polished either, but let me know how I do:
1: m/^([.]*)[^,]"\s*$/
2: m/^([.]*),\s$/
3: m/^(.*)$/
Note: for #1, I am not sure if by "without a preceding" you be no commas or just not one before "
I suggest not creating one regex to "rule them all"; instead check for each line in the order of precedence that you want; for example, #1 is probably your 'catch-all'.
Your question is actually very general, so if you are looking for more specific help in doing something, you need to get more detailed.
| [reply] [d/l] |