日期:2014-05-17 浏览次数:20574 次
string html= "<asp:Content ID=\"Content1\" ContentPlaceHolderID=\"head\" runat=\"Server\">";
string pattern = "\\s*(?<key>[^=]+)=\"(?<value>[^\"]+?)\"";
foreach (Match item in Regex.Matches(html, pattern))
{
Response.Write("key=" + item.Groups["key"].Value+"<br/>");
Response.Write("value=" + item.Groups["value"].Value + "<br/>");
Response.Write("================================<br/>");
}
Response.End();
key=value=Content1
================================
key=ContentPlaceHolderID
value=head
================================
key=runat
value=Server
================================
string pattern = "\\s+(?<key>[^=]+)=\"(?<value>[^\"]+?)\"";