zoukankan      html  css  js  c++  java
  • 匹配汉字的正则表达式

    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();
            }
        }

  • 相关阅读:
    day9文件处理
    day8字符编码
    js小数乘法精确率问题
    webstorm上传vue代码至git
    vue项目关闭eslint检查
    MongoDB相关操作
    Redis持久化存储
    Redis 数据类型
    linux常用命令
    初识NoSQL
  • 原文地址:https://www.cnblogs.com/liancs/p/3879295.html
Copyright © 2011-2022 走看看