引用中的Ruby RegEx逗号

时间:2014-12-23 17:13:54

标签: ruby regex

我想使用正则表达式来识别双引号内出现的逗号,然后我会想要删除那些逗号。引号中可以有任意数量的逗号,并且一行上可以有多组引号。所以这是一个输入和所需输出的例子:

dog, "apple, three", tree, cat, "orange, yellow", leaf   =>   
dog, "apple three", tree, cat, "orange yellow", leaf

dog, "apple, three, blue", tree, cat, "orange, jar, yellow", leaf   =>   
dog, "apple three blue", tree, cat, "orange jar yellow", leaf

我想删除引号中的逗号,而不是外部的逗号,并按原样保留其余的。

0 个答案:

没有答案