正则表达式提取数据的方法

来源:互联网 发布:阿里云重新挂载数据盘 编辑:程序博客网 时间:2024/04/28 20:21

.*?)','FinalPrice'/:'(?.*?)','SoldOut'/:'(?.*?)','DailyDealTotalOriginalPrice'/:'(?.*?)','DailyDealTotalFinalPrice'/:'(?.*?)','DailyDealCount'/:'(?.*?)'}]]>


foreach (RegexStringList regexStringList in m_RegexListConfig.RegexStringList)
                {
                    if (regexStringList.RegexName.ToLower() == "iphone home page")
                    {
                        Regex regex = new Regex(regexStringList.RegexString, RegexOptions.Singleline);
                        Match match = regex.Match(server.ResponseContent);
                        
                        if (!string.IsNullOrEmpty(match.Groups["DailyDealCount"].Value))  
                        {
                            server.DailyDealTotalFinalPrice = int.Parse(match.Groups["DailyDealCount"].Value);
                        }
                    }
                }

原创粉丝点击