C# 正则表达式匹配盘符

if (!Regex.IsMatch(diskName, @"^[c-zC-Z](:\\)?$"))
   {
     throw new FormatException($"{diskName} is not an effective disk name.");
   }

 

posted @ 2018-09-16 16:10  梦醒江南·Infinite  阅读(587)  评论(0编辑  收藏  举报