我正在尝试以以下方式在C#中拆分字符串:
传入的字符串格式如下:
string str = "[message details in here][another message here]/n/n[anothermessage here]"
我正在尝试将其拆分为字符串数组,形式如下
string[0] = "[message details in here]"
string[1] = "[another message here]"
string[2] = "[anothermessage here]"
我试图以这种方式进行操作
string[] split = Regex.Split(str, @"\[[^[]+\]");
以这种方式并不能正常工作,我只得到了一个空字符串数组
如果有帮助将不胜感激!