Your Regular Expression will only return one Match object with 2 subgroups. You can access those groups using the Groups collection of the Match object.
Try something like:
foreach (Match r in results) // In your case, there will only be 1 match here
{
foreach(Group group in r.Groups) // Loop through the groups within your match
{
Console.WriteLine(group.Value);
}
}
This allows you to match multiple filenames in a single string, then loop through those matches, and grab each individual group from within the parent match. This makes a bit more sense than returning a single, flattened out array like some languages. Also, I'd consider giving your groups names:
Regex regx = new Regex(@"^.*(?<filename>vdi(?<version>[0-9]+\.[0-9]+)\.exe).*$");
Then, you can refer to groups by name:
string file = r.Groups["filename"].Value;
string ver = r.Groups["version"].Value;
This makes the code a bit more readable, and allows group offsets to change without breaking things.
Also, if you're always parsing only a single filename, there's no reason to loop through a MatchCollection at all. You can change:
MatchCollection results = regx.Matches("vdi1.0.exe");
To:
Match result = regx.Match("vdi1.0.exe");
To obtain a single Match object, and access each Group by name or index.
Groupsproperty to access the subgroups.1.1? That doesn't event occur invdi1.0.exe. Did you mean1.0?