按特定子字符串拆分字符串



假设我有这个字符串

[0] playerName19  [1] playerName17  [2] playerName18  [3] playerName15  [4]      playerName59  [5] playerName16  [6] playerName6  [7] playerName60

如何使用Java将其拆分为如下内容:

[0] playerName19, [1] playerName17, [2] playerName18... 

我尝试使用split(),但问题是playerName号码扩展是随机生成的,并为每个查询更改。

按照[num]之前存在的空间进行分割。

string.split("\s+(?=\[\d+\])");

最新更新