using System.Text.RegularExpressions;
public static void Main()
string[] ids = new string[]{"12345678", "123", "", "-12341234", "asdf", "123412341234"};
string pattern = "^[0-9]{8}$";
Regex regex = new Regex(pattern);
for(int i = 0; i < ids.Length; i++)
Match match = regex.Match(ids[i]);
Console.WriteLine(ids[i] + ": " + match.Success);