string pattern = @"\d{3}(-XX-)\d{2}(/)(?:\d{5}|\d{7})";
string value1 = @"111-XX-99/12345";
string value2 = @"111-XX-99/1234567";
var rez1 = Regex.IsMatch(value1, pattern);
var rez2 = Regex.IsMatch(value2, pattern);