我最近学着用C#正则匹配所要数据,可是如果文件比较大情况下,输出的时候文件内容的前面部分会显示不完整,想请教下大家如何解决这种问题??以下是我的代码,麻烦大家帮忙看下~~using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Collections;
using System.Text.RegularExpressions;namespace rdmbl
{
    class mbl
    {
        static void Main(string[] args)
        {
            int counter = 0;
            string strLine;
            string line;
            StreamReader file = new StreamReader("C:\\...\\1.txt");            Regex count = new Regex(@"Fuse ID = H\d{7}_\d{3}_-?\d{2}_-?\d{2}");
            Regex bin = new Regex(@"Dbin = \d{3,4}");            while ((strLine = file.ReadLine()) != null)             {
                 ++counter;
                 if (count.IsMatch(strLine) || bin.IsMatch(strLine)) 
                 {
                     line = count.Match(strLine).Value + "\t" + bin.Match(strLine).Value + "\n";
                     Console.WriteLine(line);                     
                 }             }
            file.Close();
            Console.ReadLine();        }
    }
}