in reply to Repairing bad CSV

Hello, fellow.

You shall use this:

s/([^,])\"([^,])/$1\"\"$2/g;

I unfortunatelly have no data where to test this. Please let me know if I made a mistake. I will gladly correct the problem for you.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Just Another Perl Monk

Replies are listed 'Best First'.
Re: Re: Repairing bad CSV
by iburrell (Chaplain) on Jun 17, 2003 at 20:24 UTC
    That mostly works. It will match \n at the end of the line. I also usually use not-matching group. This is what I ended up using:
    s/(?:[^,])"(?:[^,\n])/""/g;