Sel*_*ron 5 java regex csv string split
我有一个像这样的字符串hello, "darkness, my", (old, friend),我想要这个分割的结果:
hello
"darkness, my"
(old, friend)
我找到了一种忽略 "-marks ( ,?=([^\"]*\"[^\"]*\")*[^\"]*$) 中逗号的方法和另一种忽略括号中逗号的方法 ( ,(?=[^\\)]*(?:\\(|$)))。
当我使用第一个时,我得到:
hello
"darkness, my"
(old
friend)
当我使用第二个时,我得到:
hello
"darkness
my"
(old, friend)
但是我该如何结合这两种解决方案呢?
| 归档时间: |
|
| 查看次数: |
4895 次 |
| 最近记录: |