private static string GetHtmlDomAttr(string html, string id, string attrname)
{
string xmatchstring = "<[^<>]+id=\"{0}\"\\s*{1}=\"(?<attvalue>\\S*)\"[^>]*>|<[^<>]+{1}=\"(?<attvalue>\\S*)\"\\s*id=\"{0}\"[^>]*>";
string xmathcstringend = string.Format(xmatchstring, id, attrname);
MatchCollection xmatchs = Regex.Matches(html, xmathcstringend, RegexOptions.IgnoreCase);
if (xmatchs.Count > 0)
{
Match fristMatch = xmatchs[0];
return fristMatch.Groups["attvalue"] == null ? "" : fristMatch.Groups["attvalue"].Value;
}
//Match xmatch = Regex.Match(html, xmathcstringend, RegexOptions.IgnoreCase);
//if (xmatch != null)
//{
// return xmatch.Groups["attvalue"]==null?"":xmatch.Groups["attvalue"].Value;
//}
return "";
}