I am extracting a string from an XML file in C# and need the second number in "I[1,2]" which would be 2.
Regex regex = new Regex(@"\[.*?\]");
MatchCollection matches = regex.Matches(inputChannel.Value);
var result = matches[0].Value.Split().Where(x => x.StartsWith("[") && x.EndsWith("]"))
.Select(x => x.Replace("[", string.Empty).Replace("]", string.Empty))
.ToList();
where inputChannel.value = "I[1;2]"
This code gets the two numbers and sticks them into a list but is there a way to split the two numbers and put them into a list?