匹配中文字符
[\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]

以上就是【正则表达式匹配中文与双字节的代码】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论