http://www.perlmonks.org?node_id=466349


in reply to CSV cleanup problem...

The best definition of an embedded quote I've thought up for this situation is: If the quote isn't followed by a comma, assume it's an embedded quote.

# Fix embedded quotes. s/"(?![",])/""/g;

To remove the spaces before the commas, just do it after using Text::CSV_XS.

That's what I get for trying to answer a question on my way out.

Replies are listed 'Best First'.
Re^2: CSV cleanup problem...
by kaif (Friar) on Jun 14, 2005 at 02:37 UTC

    I would watch out there: applying your regex to the sample input results in the following:

    ""title", ""Some Name, ""some weird title"", ""555-555-5555""