using System.Text.RegularExpressions;
public static void Main()
string format = "CST-000000";
var match = Regex.Match(format, "(.*?)(0+)$");
throw new ArgumentException("Input must end with one or more zeros");
string prefix = match.Groups[1].Value;
string zeros = match.Groups[2].Value;
Console.WriteLine($"{prefix}{value:zeros}");