How to use ruby gsub Regexp with many matches?
问题 I have csv file contents having double quotes inside quoted text test,first,line,"you are a "kind" man",thanks again,second,li,"my "boss" is you",good I need to replace every double quote not preceded or succeeded by a comma by "" test,first,line,"you are a ""kind"" man",thanks again,second,li,"my ""boss"" is you",good so " is replaced by "" I tried x.gsub(/([^,])"([^,])/, "#{$1}\"\"#{$2}") but didn't work 回答1: Your regex needs to be a little more bold, in case the quotes occur at the start