C# 正则表达式匹配盘符

if (!Regex.IsMatch(diskName, @"^[c-zC-Z](:\)?$"))
   {
     throw new FormatException($"{diskName} is not an effective disk name.");
   }
原文地址:https://www.cnblogs.com/144823836yj/p/9656410.html