using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;
public class Program
{
public static void Main()
string str = "v5.6.8_beta2";
string pattern = @"^[vV](\d+)\.(\d+)\.(\d+)_?\w+(\d+)";
MatchCollection matches = Regex.Matches(str, pattern);
var groups = matches.First().Groups;
foreach(var g in groups)
Console.WriteLine(g);
}