using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Text.RegularExpressions;
using System.IO;
namespace taobao_trades_sold_get
{
class Program
{
public static void Main(string[] args)
{
//taobao_trades_sold_get.OrderDown down = new OrderDown();
//down.Oreder();
================================================================
读文件
================================================================
FileStream file = new FileStream(@"d:\\sa.txt", FileMode.Open);
byte[] bt = new byte[file.Length];
file.Read(bt, 0, bt.Length);
string str = Encoding.Default.GetString(bt);
string Id = "";
string s = "";
=====================================================================
正则组匹配
=====================================================================
Regex regexid = new Regex("name-(\\d{0,9})\" data-id?(.+)class=\"text J_CatName\" value=\"(.+)\" data-condition=?", RegexOptions.Compiled);
MatchCollection mc = regexid.Matches(str);
foreach (Match m in mc)
{
Id = m.Groups[1].Value;
s = m.Groups[3].Value;
string sql = string.Format("insert into dbo.CategoriesTaobaodian_WeiRan(taobaoDian_CategoryID,taobaoDian_Categoryname) values('{0}','{1}')",Id, s);
DataDrive.sqlDataConn.connGetDataSetByExecSql(sql);
Console.WriteLine(s);
Console.WriteLine(Id);
}
Console.ReadKey();
}
}
}