静态文件生成相关技术文档(转载)
1,得到网页上的链接地址:
string matchString = @"<a[^>]+href=\s*(?:'(?<href>[^']+)'|""(?<href>[^""]+)""|(?<href>[^>\s]+))\s*[^>]*>";
2,得到网页的标题:
string matchString = @"<title>(?<title>.*)</title>";
3,去掉网页中的所有的html标记:
string temp = Regex.Replace(html, "<[^>]*>", ""); //html是一个要去除html标记的文档
4, string matchString = @"<title>([\S\s\t]*?)</title>";
早先公司叫我做一个网站静态生成器,一直没找到解决办法,现在看到了这些,可行性大大提高,不过现在没时间去做,留在这里为以后提供参考!
string matchString = @"<a[^>]+href=\s*(?:'(?<href>[^']+)'|""(?<href>[^""]+)""|(?<href>[^>\s]+))\s*[^>]*>";
2,得到网页的标题:
string matchString = @"<title>(?<title>.*)</title>";
3,去掉网页中的所有的html标记:
string temp = Regex.Replace(html, "<[^>]*>", ""); //html是一个要去除html标记的文档
4, string matchString = @"<title>([\S\s\t]*?)</title>";
早先公司叫我做一个网站静态生成器,一直没找到解决办法,现在看到了这些,可行性大大提高,不过现在没时间去做,留在这里为以后提供参考!