in reply to problems parsing CSV
To "escape" a "(double quote) in the CSV format you put another " (double quote) in front of it (or behind it) - who is to say which one is which - but two means one.
I am not a regex guru, but there are folks here who are. The below shows what needs to be done in this particular case. More general solutions are possible.
#!/usr/bin/perl -w use strict; =doc stuff,"more","foo (1994 "bar" only)",1234,1988,3.0,"" should be: stuff,"more","foo (1994 ""bar"" only)",1234,1988,3.0,"" or could also be: stuff,more,foo (1994 "bar" only),1234,1988,3.0,"" =cut my $x = 'stuff,"more","foo (1994 "bar" only)",1234,1988,3.0,""'; $x =~ s/ "/ ""/g; $x =~ s/" /"" /g; print $x; # prints: # stuff,"more","foo (1994 ""bar"" only)",1234,1988,3.0,""
|
|---|