in reply to Repairing bad CSV

Im extremely doubtful that you understand what you want properly. The first example meets your requirement (find all quotes not preceded or followed by commas and turn them into two quotes) the second a modified form using clases that doesnt help much, and the third is 'and' form (find all quotes neither preceded nor followed by commas and turn them into two quotes). None of them make much sense to me. *shrugs*

#!perl -l for ('"Boo","Baz","Bar"','",",","') { { local $_=$_; s/(?<!,)"|"(?!,)/""/g; print "Or : $_\n"; } { local $_=$_; s/([^,])"|"(([^,]))/$1 ? $1.'""' : '""'.$2/ge; print "Or (class): $_\n"; } { local $_=$_; s/([^,])"([^,])/$1""$2/g; print "And: $_\n"; } } __END__ Or : ""Boo"",""Baz"",""Bar"" Or (class): ""Boo"",""Baz"",""Bar"" And: "Boo","Baz","Bar" Or : "",",","" Or (class): ",","," And: ",",","

---
demerphq

<Elian> And I do take a kind of perverse pleasure in having an OO assembly language...

• Update:  
On rereading this I realize that it came off sounding the wrong way, and that I had probably interpreted your requirements overly literally. My apologies for any offense caused. :-)