我有一个包含以下行的CSV文件:
val s = "\"a,b,c,d\",2,3,4" // it also could have been "a,b,d",2,3,4 or "a,,d",2,3,4 ...
val regex = new Regex(
"\"([^,]+)(,+([^,]*))+\"",
"begin",
"test", "end")
val line = regex.replaceAllIn(s, m => m.group("begin") + "#" + m.group("end"))
结果是: a#d,2,3,4
但我想这样:a#b#c#d,2,3,4
有没有办法获得正则表达式检测到的所有值?