|No such thing as a small change|
Replacing comas in a substring when it is between quotesby ZlR (Chaplain)
|on Mar 28, 2012 at 18:08 UTC||Need Help??|
ZlR has asked for the
wisdom of the Perl Monks concerning the following question:
Hello Monks & Monkettes,
Here i am once again with another too hard for me problem ! I was given numerous csv files, and they use a comma as a field separator. To my surprise, some fields contain commas as a value. Since I intend to split on comas this kinda wrecks it all up. Those fields get enclosed in quotes, so one can see that the comas inside are values, and not a field separator.
Maybe I could use a csv module, but that's too easy ! But seriously, it got me thinking on this regexp problem :
How can i turn it into :
I do not have a single idea so far ...
Anyone knows how ? Thanks !