split a string only on spaces that are outside curly braces

前端 未结 3 1111
耶瑟儿~
耶瑟儿~ 2021-01-16 17:11

I am new to regex and I need some help. I read some topics similar to this issue, but I could not figure out how to resolve it.

I need to split a string on every bla

3条回答
  •  执笔经年
    2021-01-16 17:27

    I solved my problem using:

    StringCollection information = new StringCollection();  
    foreach (Match match in Regex.Matches(string, @"\{[^}]+\}|\S+"))  
    {  
       information.Add(match.Value);  
    }
    

    Thanks for your help guys !!!

提交回复
热议问题