Remove more than one comma in between quotes in CSV file using Regex

我们两清 提交于 2020-01-02 08:56:56

问题


all! Have CSV files coming in with with text inside double quotes that contain one or more commas and I am wondering if there is a regex form for Notepad++ that would remove any number of commas inside a CSV file.

For example I need to go from the this:

text,text1,"interesting, text,"

To this:

text,text1,"interesting text"

There can be 1,2 or more commas inside the quotes.

Anyone know a of a way to make this happen using regex form in Notepad++?

Thanks in advance!


回答1:


use this pattern

,(?!(([^"]*"){2})*[^"]*$)

and replace with nothing
it is looking for a comma , that does not see an optional even number of double quotes " to the end of the string



来源:https://stackoverflow.com/questions/26664371/remove-more-than-one-comma-in-between-quotes-in-csv-file-using-regex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!