please help me in this problem. I want to split "-action = 1" into "action" and "1".
string pattern = @"^-(\S+)=(\S+)$";
Regex regex = new Regex(pattern);
string myText = "-action=1";
string[] result = regex.Split(myText);
I do not know why the result has a length = 4.
result[0] = ""
result[1] = "action"
result[2] = "1"
result[3] = ""
Please help me.
P / S: I am using .NET 2.0.
Thank.
Hello, I tested using the line: @ "- destination = C: \ Program Files \ Release", but it has the wrong result, I don’t understand why result length = 1. I think because it has a space in the line.
I want to split it into "destination" and "C: \ Program Files \ Release"
Additional information: This is my requirement: -string1 = string2 → divide it into: string1 and string2. In string1 and string2 do not contain characters: '-', '=', but they can contain spaces.
, . .