简体   繁体   English

崇高的文字:使用正则表达式替换每n次出现的逗号

[英]Sublime text: Replace every nth occurrence of comma using regex

I have a file with hundreds of line like quoted below. 我有一个包含数百行的文件,如下所示。 I want to change the indexed array to an associative array by adding keys. 我想通过添加键将索引数组更改为关联数组。

(['Maricao', 'PR', '00606', '18.182778', '-66.980278']),

so after the process, what I need is 所以经过这个过程,我需要的是

(['name' =>'Maricao', 'code' => 'PR', 'zip' => '00606', 'lat' => '18.182778', ' lng' =>'-66.980278']),

Assuming the keys and order are the same. 假设键和顺序相同。 Find: 找:

('[^']+', )('[^']+', )('[^']+', )('[^']+', )('[^']+')

Replace with: 用。。。来代替:

'name' => \1'code' => \2'zip' => \3'lat' => \4'lng' => \5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM