取标题
let rxTit = new Regex(@"<title>([^\b]+?)</title>", RegexOptions.IgnoreCase ||| RegexOptions.Singleline)
let title = rxTit.Match(stream).Groups.[1].Value
注意:
1、Group.[0]: 含 <title></title>
Group.[1]:不含 <title></title>
2、如果取出的字符出现乱码,就要考虑改一下字符集:
use reader = new StreamReader( rst, Encoding.GetEncoding("UTF-8") )
use reader = new StreamReader( rst, Encoding.GetEncoding("GB2312") )
因为各页面会用不同的字符集。