使用正则验证输入大写字母

实现效果:

  

知识运用:

  

实现代码:

        static void Main(string[] args)
        {
            Console.Title = "使用正则验证输入大写字母:";
            Console.SetWindowSize(55,10);
            if(System.Text.RegularExpressions.Regex.IsMatch(Console.ReadLine(),"^[A-Z]+$"))
                Console.WriteLine("通过");
            else
                Console.WriteLine("错误");
        }
原文地址:https://www.cnblogs.com/feiyucha/p/10044834.html