using System.Text.RegularExpressions;
public static void Main()
string text = "holidays/*/2024/*/foobar";
Regex re = new Regex(@"(?:^|\*)(?=([^*]+)(\*|$))");
MatchCollection matches = re.Matches(text);
foreach (Match match in matches) {
from Group matchGroup in match.Groups
where matchGroup.ToString() != ""
select matchGroup.ToString()