朋友你好 GET / HTTP/1.0
Host: www.sjzfudao.com
Connection: Keep-AliveHTTP/1.1 200 OK
Date: Fri, 14 Sep 2012 03:12:04 GMT
Server: Apache/2.2.3 (Red Hat)
Last-Modified: Sat, 08 Sep 2012 10:22:20 GMT
ETag: "7e6e87-7081-197acf00"
Accept-Ranges: bytes
Content-Length: 28801
Connection: close
Content-Type: text/html把上面这一段话 通过正则 或者其他的方法
例如 输入 Content-Length: 取出 28801我还要 取出 title 关键词 描述 的正则 (有的网页 可能没有关键词 或者没有 描述)
希望大家给出正则 谢谢了!!!
Host: www.sjzfudao.com
Connection: Keep-AliveHTTP/1.1 200 OK
Date: Fri, 14 Sep 2012 03:12:04 GMT
Server: Apache/2.2.3 (Red Hat)
Last-Modified: Sat, 08 Sep 2012 10:22:20 GMT
ETag: "7e6e87-7081-197acf00"
Accept-Ranges: bytes
Content-Length: 28801
Connection: close
Content-Type: text/html把上面这一段话 通过正则 或者其他的方法
例如 输入 Content-Length: 取出 28801我还要 取出 title 关键词 描述 的正则 (有的网页 可能没有关键词 或者没有 描述)
希望大家给出正则 谢谢了!!!
string tempStr = @"GET / HTTP/1.0
Host: www.sjzfudao.com
Connection: Keep-AliveHTTP/1.1 200 OK
Date: Fri, 14 Sep 2012 03:12:04 GMT
Server: Apache/2.2.3 (Red Hat)
Last-Modified: Sat, 08 Sep 2012 10:22:20 GMT
ETag: ""7e6e87-7081-197acf00""
Accept-Ranges: bytes
Content-Length: 28801
Connection: close
Content-Type: text/html";
string tag = "Content-Length";
string pattern = @"(?i)(?<=\s)"+tag+@"[::](((?!\n).)+?)(?=\s|$)"; string result = Regex.Match(tempStr, pattern).Groups[1].Value;//28801