匹配中文字符 [\u4e00-\u9fa5] C#
复制代码 代码如下:
class Class1 { static void Main() { string s = "中文 chinese"; Regex regx = new Regex("[\u4e00-\u9fa5]+"); Match m = regx.Match(s); Console.WriteLine(m.Groups[0].Value); // 中文 Console.ReadKey(); } }
匹配双字节字符(包括汉字) [^\x00-\xff]查看更多关于正则表达式匹配中文与双字节的代码_正则表达式的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did9273