Escape comma when using String.split

前端 未结 4 1131
野趣味
野趣味 2020-12-08 20:58

I\'m trying to perform some super simple parsing o log files, so I\'m using String.split method like this:

String [] parts = input.split(\",\");         


        
4条回答
  •  无人及你
    2020-12-08 21:42

    I think

    input.split("[^\\\\],");
    

    should work. It will split at all commas that are not preceeded with a backslash. BTW if you are working with Eclipse, I can recommend the QuickRex Plugin to test and debug Regexes.

提交回复
热议问题