Here is the deal, I am going through an INI file with some code. The idea is to return all of the categories found in the INI file with a regex, and then set at an arraylist = to results.
So here is the code:
switch -regex -file $Path
{
"^\[(.+)\]$" {
$arraylist.Add($matches[1])
}
}
However, the function returns not only the categories but also a count of the categories. For example, if the INI file looks like this:
[Red]
[White]
[Blue]
The output is:
0
1
2
Red
White
Blue
How can I fix this?