码迷,mamicode.com
首页 > 其他好文 > 详细

正则表达式

时间:2014-09-24 00:43:15      阅读:308      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   for   div   sp   cti   on   

   string pattrn2 = "<sm>(?<sm>[\\s\\S]*?)</sm>";
                        MatchCollection results = Regex.Matches(IPstrLine, pattrn, RegexOptions.IgnoreCase);
                        MatchCollection results2 = Regex.Matches(IPstrLine, pattrn2, RegexOptions.IgnoreCase);
                        for (int j = 0; j < results.Count; j++)
                        {
                            string ip = results[j].Groups["ip"].Value.Trim();
                            string dk = results[j].Groups["port"].Value.Trim();
                            string sm = "";
                            try
                            {
                                sm = results2[j].Groups["sm"].Value;
                            }
                            catch { }

                            if (Xml_Data.CoreDS.Tables["ipdata"].Select("ip=‘" + ip + "‘ and qingkuang =‘购买‘").Length <= 0)
                            {
                                base.Invoke((MethodInvoker)delegate()
                                {
                                    Xml_Data.CoreDS.Tables["ipdata"].Rows.Add(new object[] { null, ip, dk, sm, "", "", "购买", 0, 0, true });
                                    worker.ReportProgress(0, "导入|IP正常处理保存 IP:" + ip + ":" + dk);
                                });
                            }
                        }

 

正则表达式

标签:style   blog   color   io   for   div   sp   cti   on   

原文地址:http://www.cnblogs.com/wangchuang/p/3989564.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!