日期:2014-05-17 浏览次数:21293 次
            StreamReader reader = new StreamReader("c:\\1.txt",Encoding.Default);
            string source = reader.ReadToEnd();
            Regex reg = new Regex(@"(?is)\d{4}\.\d{2}\.\d{2}");
            MatchCollection mc = reg.Matches(source);
            foreach (Match m in mc)
            {
                MessageBox.Show(m.Value);
            }
------解决方案--------------------
       StreamReader reader = new StreamReader("c:\\1.txt", Encoding.Default);
            string source = reader.ReadToEnd();
            Regex reg = new Regex(@"(?is)\d{4}\.\d{2}\.\d{2}");
            MatchCollection mc = reg.Matches(source);
            string str = "";
            foreach (Match m in mc)
            {
                str + m.Value + ",";
            }
            控件ID.Text = str.TrimEnd(',');