How may I apply double quotes around every value of csv file using TextMate?

我的未来我决定 提交于 2019-12-04 05:53:17

Here are the important portions of the regex. Hopefully I got it right when I converted to textmate format:

Search - ([^,]*)(,|$)

Replace - "$1"$2

Search explanation: Find every character that is not a comma, up until we reach a comma, or the end of the line. Capture the match for string to be quoted in one variable, and capture the comma/end-of-line match in another variable.

Replace explanation: The original string, quoted, and the comma or end-of-line that follows it.

You could start with:

find: ,
replace: "," 

then add a " at the start and at the end?

This worked great for me. Did the find/replace for rows first

Then did the simple find / replace for , => ","

Had to add the first quote, and adding the "Markup" made it easy.

Thanks and good luck.

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