I have several lines that need to be updated where double apostrophes get replaced in some locations and slashed out but not others.
So :
(2, 'Name 2', '', 8, 0, 0, 1, 'Info blah blah', 0, 4),
(3, 'Name 3', 'A normal bit of information', 8, 1, 0, 1, 'Info more blah', 0, 4),
(45, 'Name 45', 'Info with '' in it like it''s stuff', 356, 10, 1, 1, '', 0, 9)
Needs to become:
(2, 'Name 2', '', 8, 0, 0, 1, 'Info blah blah', 0, 4),
(3, 'Name 3', 'A normal bit of information', 8, 1, 0, 1, 'Info more blah', 0, 4),
(45, 'Name 45', 'Info with \'\' in it like it\'\'s stuff', 356, 10, 1, 1, '', 0, 9)
When trying various methods I manage to update all ” with \’\’ which then breaks functions used later on.
Uhm, this really requires some parsing. If you use regular expressions it will really only work on a best bet basis.
If you can assume that
'',is always the empty string in your CSV list, then looking out for the comma is an option. Should one of the strings however contain a comma after the double quote then this is going to fail:To add some safety you can add a prefix check like
(?<=[(\s])– but that helps only little.