using System;
using System.Text.RegularExpressions;
public class Program
{
public static void Main()
string text="AB4000-01-433593-1-1";
// ^ start of word match any character A-Z or 0-9 until you hit a dash, then match any character except a dash. Capture in group 1
string regEx = @"^([A-Z,0-9]+-[^-]+)";
Regex r = new Regex(regEx, RegexOptions.IgnoreCase);
Match m = r.Match(text);
if(m.Success)
Console.WriteLine(m.Groups[0]);
}