C# 表达式学习积累
1 /// <summary> 2 /// 读取html里面的body内容(不包括<body>标签) 3 /// </summary> 4 /// <param name="htmlUrl">要读取的html地址</param> 5 private string ReadHtmlToEditHtml(string htmlUrl) 6 { 7 string htmlContent1 = string.Empty; 8 using (StreamReader reader = new StreamReader(htmlUrl)) 9 { 10 htmlContent1 += reader.ReadToEnd(); 11 } 12 Regex reg = new Regex("(?is)<body[^>]*>(?<body>.*?)</body>"); 13 string bodyHtml = ""; 14 bodyHtml = reg.Match(htmlContent1).Groups["body"].Value; 15 return bodyHtml; 16 }