日期:2014-05-18 浏览次数:20835 次
string tempStr = File.ReadAllText(@"C:\Documents and Settings\Administrator\桌面\Test.txt", Encoding.GetEncoding("GB2312"));//读取tx string pattern = @"(?i)(?<=\d+ +)(\d+\s+){3}"; string[] ss = Regex.Matches(tempStr, pattern).Cast<Match>().Select(a => a.Value).Distinct().ToArray(); /* * [0] "12 3 17 " string [1] "12 3 18 " string [2] "12 10 19 " string [3] "02 3 18 " string [4] "02 12 18 " string */