I've got some pipe-delimited data that looks like this:
field|field|field|field|another "field"|field
field|field|field|"another" field|field|field
field|"fie|ld"|field|field|field|field
And the problem that I'm having is that the double-quotes aren't properly formed for a delimited field (fields containing the delimiter, or the quotes, should itself be wrapped with double-quotes, and the double-quotes should be excaped with another double-quote). This is what the output should be:
field|field|field|field|"another ""field"""|field
field|field|field|"""another"" field"|field|field
field|"fie|ld"|field|field|field|field
Anyone know if there is an easy way to do this with a regular expression?