首先我用流读取一个txt的文件,文件内容如下:
0003B1CC,38,大家{换行}我?0003B1F4,92,三天...是在{换行}晚上吗?是,{换行}应该.我一行一行读取,然后使用正则表达式去掉数字以及英文,但是在遇到‘{’,“...”等标点符号后后面的不读取了。原因可能是match读取匹配汉字后遇到标点后面的就不读取了,求解决方法。
附上代码:
            StreamReader sr = new StreamReader(txtpath.Text, System.Text.Encoding.GetEncoding("gb2312"));
            string sLine = "";
            string txt = "";
            while (sLine != null)
            {
                sLine = sr.ReadLine();
                string regexStr = "[\u4e00-\u9fa5]+";
                Regex r = new Regex(regexStr, RegexOptions.None);
                if (sLine != null)
                {
                    Match mc = r.Match(sLine);
                    txt += mc.ToString();
                }
            }
            sr.Close();