How can I apply double quotes around each csv file value using TextMate?

I have a csv file with the following format:

Csv example:

bear,brown,mean,large
ant,black,strong,tiny
cat,yellow,moody,small

How can I apply double quotes around each value? How can I accomplish this with regex?

I am using TextMate (text editor) to search / replace w / regular expression.

+5
source share
3 answers

Here are the important parts of regex. I hope everything worked out when I reworked the textmate format:

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

Replace - "$1"$2

: , , . , , / .

: , , .

+21

:

find: ,
replace: "," 

" ?

+2

. / Image of Regex Find / Replace

/, => ","

, "" .

.

0
source

Source: https://habr.com/ru/post/1761382/


All Articles