Java正则表达式用逗号分隔但忽略注释中的逗号

我需要正则表达式用逗号(,)分割字符串,但忽略注释部分中的逗号,我在更改你的正则表达式之后尝试了很多。它不是成功的例如。

Command=RTRV-EQPT, Completion Code= DENY, Error Code= II:AC, Problem Description= /* Input Inva,lid *******ACcess =iden:tifier */, Comment=null, 

对于您的特定情况,为什么不首先删除注释然后拆分,它可以简化您的问题。

 txt.replace("/*reg to match the comment here */", " ").split(','); 

不要重新发明轮子: 这是一个易于使用的解析器