because THIS is a valid comma delimited string
1234 , "Jones, Jim", Fred, " 1,2,3,4,5 "
a replace all would be wrong in this case as it would result in
1234 -> "Jones -> Jim" -> Fred -> " 1 -> 2 -> 3 -> 4 -> 5 "
where the correct output would be
1234 -> Jones,Jim -> Fred -> 1,2,3,4,5
and if you look close.. it DOES use a simple replaceall if there are no DOUBLE QUOTES in the string
This would be a valid record as well:
Contents translate to:
When you find a quote, double quote or a comma you have to backpedal one position to see if it's escaped. If it is then it's a plain character and neither a delimiter nor an enclosure. Likewise a backslash is an escape character and should be translated as a backslash only if doubled.
Obviously, this only applies if you want to escape, escape with backslash and escape only certain characters otherwise take backslash literally.