I can split a string into two based on 2 spaces:
string Line = "1 2";
Regex.Split(Line, " ");
=> 1, 2
I would like to add an exception. Only split if 'not enclosed by [ ]' as shown in this example.
string Line = "1 2 [1 2]";
Regex.Split(Line, " ");
=> 1, 2, [1 2]
Can I fairly easily achieve this via regex? By the way, I use .NET.
1 2 hello [how are] you?1 2 [1 2 [1 2]] 3 4what should that produce?