日期:2014-05-17 浏览次数:20836 次
string tempStr = File.ReadAllText(@"C:\Users\myx\Desktop\Test.txt", Encoding.GetEncoding("GB2312"));//读取txt
List<List<string>> _list = new List<List<string>>();
string pattern = @"(?i)time=(['""]?)(?<Time>[^'""]*?)\1\s*?id=(['""]?)(?<Id>[^'""]*?)\2\s*?name=(['""]?)(?<Name>[^'""]*?)\3\s*?";
pattern += @"card_src=(['""]?)(?<Card_src>[^'""]*?)\4\s*?type=(['""]?)(?<Type>[^'""]*?)\5\s*?";
foreach (Match m in Regex.Matches(tempStr, pattern))
{
List<string> _line = new List<string>();
_line.Add(m.Groups["Time"].Value);
_line.Add(m.Groups["Id"].Value);