Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: CSV cleanup problem...

by ikegami (Pope)
on Jun 14, 2005 at 02:14 UTC ( #466349=note: print w/replies, xml ) Need Help??

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""

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://466349]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2018-08-16 13:43 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (167 votes). Check out past polls.