I want to replace each double quote of a csv record to be replaced with some other character , lets say @#@, keeping inner double quotes unchanged.
e.g. consider following record
123453,"The NFL is promoting the importance of annual mammogram screenings for women over 40 in the prevention of breast cancer through their "A Crucial Catch" campaign.","Pittsburgh Steelers","NFL"
from this record I want to replace double quotes with @#@ from each fields beginning & end so that it becomes
123453,@#@The NFL is promoting the importance of annual mammogram screenings for women over 40 in the prevention of breast cancer through their "A Crucial Catch" campaign.@#@,@#@Pittsburgh Steelers@#@,@#@NFL@#@
please notice “A Crucial Catch” is unchanged as it is inside already started double quotes
You could search for
and replace that with
@#@. This regex looks for a quote that is preceded or followed by a comma (or start/end of string).So, in PHP:
changes
into