All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
PHP中的session的几个问题_php资料_编程技术
asp.net,2.0的文件上传(突破上传限制4M)_[Asp.Net教程]
从...中检测到有潜在危险的,Request.Form,值的解决办法,和嵌入页面代码_[Asp.Net教程]
ASP.NET技巧:远程抓取GOOGLE的自动翻译结果_.net资料_编程技术
ASP.NET技巧:一些常用的数据操作类_[Asp.Net教程]
JS实现图片无缝滚动的完美解决_JavaScript技术_编程技术
十 Forms_[Html教程]
基于AJAX技术提高搜索引擎排名_[AJAX教程]
一个功能齐全的DataGrid分页例子_[Asp.Net教程]
防范SQL注入式攻击_[Asp.Net教程]
Reading number is top 10 pictures
漂亮的跳舞妹妹2
So beauty, will let you spray blood6
一个武林高手的故事
Go to the national museum1
Fan bingbing black wings for platform and DanLuoWang believes beauty2
Perfect small Laurie2
China's ambassador to Libya embassy was shock, and the glass is broken in
The little woman's bright wire2
大年初五接财神
做运动的校花2
Download software ranking
asp.net技术内幕
Be there or be square
Tram sex maniac 2 (H) rar bag2
SP4 for SQL2000
I'm come from Beijing1
Tram sex maniac 2 (H) rar bag12
Unix video tutorial17
Eclipse 4.2.2 For Win64
jdk1.6 for windows
网页特效实例大全
归海一刀 published in(发表于) 2014/1/30 1:21:37 Edit(编辑)
asp.net得到HTML,meta标记的内容_[Asp.Net教程]

asp.net得到HTML,meta标记的内容_[Asp.Net教程]

asp.net得到HTML meta标记的内容_[Asp.Net教程]
public static string GetSingleTagValueByAttr(string inputstring, string tagName, string attrname, string key)
{
Regex reg = new Regex("<" + tagName + " [^<>]*>", RegexOptions.IgnoreCase);
MatchCollection matchs = reg.Matches(inputstring);
string result = string.Empty;
foreach (Match match in matchs)
{
string matchValue = match.Value;
Regex regValue = new Regex("content=".*"", RegexOptions.IgnoreCase);
if (matchValue.ToLower().IndexOf(attrname.ToLower() + "="" + key.ToLower() + """) != -1)
{
if (regValue.IsMatch(matchValue))
{
result = regValue.Match(matchValue).Value;
if (!string.IsNullOrEmpty(result))
{
result = result.Replace("CONTENT=", "").Replace("content=","").Replace(""", "");
}
}
return result;
}
}
return null;
}



使用举例:

获取关键词 GetSingleTagValueByAttr(data, "meta", "name", "Keywords"); data是HTML源代码
获取描述GetSingleTagValueByAttr(data, "meta", "name", "Discription");

来源:http://blog.csdn.net/slimboy123




添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.