如何使用REGEX替换引号外的逗号? [英] How to use REGEX to replace just commas outside quotes?
本文介绍了如何使用REGEX替换引号外的逗号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有遵循以下示例的.CSV文件
I have .CSV files that follow the example below
22645.30003,2013 Mar 31,4:00:00,5:59:59,"Twilight Saga, The: Breaking Dawn - Part 2","Condon, Bill",,,4
我需要用符号replace代替逗号作为列分隔符,而保留引号内的字符串中出现的所有逗号,并打算在例如Notepad ++中的简单FIND和REPLACE中使用它。
I need to replace the comma as column separator by the symbol \ leaving intact all the commas ocurring inside the strings enclosed in quotes and intend to use it in a simple FIND and REPLACE in Notepad++ for instance.
推荐答案
您可以尝试
search : ,("[^"]*")?
replace : \\\1
(已测试并在版本6.3.2上运行)
(tested and works on version 6.3.2)
这篇关于如何使用REGEX替换引号外的逗号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文