日期:2014-05-18 浏览次数:20631 次
<select name="ProductsSearchLayout$BottomSectionPager$PagerLinksDropDownList" id="ProductsSearchLayout_BottomSectionPager_PagerLinksDropDownList" class="paginateDD" onChange="MM_jumpMenu('parent',this,0)">
<option selected="selected" value="/abella.aspx?avs=Brand%7cAbella&fa=1">Page 1</option>
</select>
static void Main(string[] args)
{
string str = @"<select name=""ProductsSearchLayout$BottomSectionPager$PagerLinksDropDownList"" id=""ProductsSearchLayout_BottomSectionPager_PagerLinksDropDownList"" class=""paginateDD"" onChange=""MM_jumpMenu('parent',this,0)"">
<option selected=""selected"" value=""/abella.aspx?avs=Brand%7cAbella&fa=1"">Page 1</option>
</select>";
Regex re = new Regex(@"(?is)<select[^>]+id=""ProductsSearchLayout_BottomSectionPager_PagerLinksDropDownList""[^>]+>\s*<option[^>]+value=""([^""]+)"">([^<]+)</option>", RegexOptions.None);
Match ma = re.Match(str);
Console.WriteLine(ma.Groups[1].Value); // 输出值为:/abella.aspx?avs=Brand%7cAbella&fa=1
Console.WriteLine(ma.Groups[2].Value); // 输出值为:Page 1
Console.ReadLine();
}
------解决方案--------------------
回家在写下。还在公司处理事情。