匹配汉字的正则表达式

class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string str = Console.ReadLine();
                string mode = "^[0-9a-zA-Z\u4E00-\u9FA5]+$";
                System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(mode);
                if (regex.IsMatch(str))
                {
                    Console.WriteLine("可以匹配输入!");
                }
                else
                {
                    Console.WriteLine("只能输入0-9、a-z、A-Z及汉字");
                }
            }
            //Console.Read();
        }
    }

原文地址:https://www.cnblogs.com/liancs/p/3879295.html