给出一个字符串,如“中国China我爱你I love you”,程序可以实现中英文的区别;
识别结果如下:共四个元素
中国
China
我爱你
I love you
string ptn = "[/u4e00-/u9fa5]+|[a-zA-Z//s]+"; System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(ptn); string z = "中国China我爱你I love you"; foreach (Match m in reg.Matches(z)) { Console.WriteLine(m.Value); }