正则表达式查找字符串之间用逗号分隔,然后添加引号? [英] Regex to find strings separated by comma, and then add quotes?
本文介绍了正则表达式查找字符串之间用逗号分隔,然后添加引号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Sublime Text 3并使用以下格式的1200税率的CSV文件:
I'm using Sublime Text 3 and have a CSV file with 1200 tax rates in this format:
Code,Country,State,Zip/Post Code,Rate,default
US-NY-10001-Rate 1,US,NY,10001,0.08875,
....
我需要一个正则表达式来查找用逗号分隔的每个值,这样我就可以用引号括起来了。
I need a regex to find each value separated by a comma so I can then wrap quotes around it.
这是否可能?
推荐答案
查找以下正则表达式使用捕获组和 backreference ):
Find the following regular expression (using capturing group and backreference):
([^,\n]+)
并替换为
"\1"
>
这篇关于正则表达式查找字符串之间用逗号分隔,然后添加引号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文