正在学习正则表达式,自己写了一个正则表达式,功能是要把英语和汉语分开,但结果不是我想要的,哪位能否指点一二。程序源代码如下:
using System;
using System.Text.RegularExpressions;

public class Test
{

    public static void Main()
    {

        Regex matchRegex = new Regex(@"([\w+\s]+)([\u4e00-\u9fa5]+)");
        Match matchMade = matchRegex.Match("accounting principle 会计准则");
        GroupCollection matchGroups = matchMade.Groups;
        Console.WriteLine(matchGroups[0].Value);
        Console.WriteLine(matchGroups[1].Value);
        Console.WriteLine(matchGroups[2].Value);
        Console.ReadLine();

    }

}
结果输出:
accounting principle 会计准则
accounting principle 会计准

我想要的结果是:
accounting principle 会计准则
accounting principle
会计准则
请懂正则的指点下,谢谢!

Posted on 2008-05-28 17:11  罗焕军  阅读(215)  评论(1编辑  收藏  举报