I have just had a thought about this, i resticted the search to include quotes, might be best to not search for them and replace all occurances anywhere in the file.
// replace
$contents = str_replace('"!#"', '","', $contents);
// with
$contents = str_replace('!#', ',', $contents);