我想从原字符串:
str = "*:我们123erewt;"中提取出“我们123erewt”,正则表达式怎么写?

解决方案 »

  1.   

    本帖最后由 lxcnn 于 2011-02-17 21:00:22 编辑
      

  2.   

     string str = "*:我们123erewt;";
                foreach (Match m in Regex.Matches(str, @"(?s)[^>]*:(?<title>[^>]*)"))
                {
                    Console.WriteLine(m.Groups["title"].Value);
                }我们123erewt;
      

  3.   

    try...            string str = "*:我们123erewt;";
                Regex reg = new Regex(@"(?<=:)[^;]+(?=;)");
                MatchCollection mc = reg.Matches(str);
                foreach (Match m in mc)
                {
                    richTextBox2.Text += m.Value + "\n";
                }
      

  4.   


    static void Main()
    {
        string str = "*:我们123erewt;";     //中提取出“我们123erewt”,正则表达式怎么写?
        Regex r = new Regex("(?<=:)[^:;]*(?=;)");
        string s = r.Match(str).Value;      //s = 我们123erewt
    }楼主能不能尊重一下回答的人?
    这么多正确答案都不选????