使用 perl,我在一个包含下面文本的大文件中“slurped”,我正在尝试$1
为给定的正则表达式捕获文件中的所有正则表达式匹配项。我的正则表达式是
=~ /((GET|PUT|POST|CONNECT).*?(Content-Type: (image\/jpeg)))/sgm
目前正在捕获粗体文本,但是,最后一次捕获正在处理行
"GET /~sgtatham/putty/latest/x86/pscp.exe HTTP/1.1" to "Content-Type: text/html; charset=iso-8859-1"
作为最后一次捕获的一部分,它不应该 b/c "text/html" 不等于我的(image\/jpeg)
. 我希望能够在没有
"GET /~sgtatham/putty/latest/x86/pscp.exe HTTP/1.1" to "Content-Type: text/html; charset=iso-8859-1" being included.
感谢任何帮助,谢谢。
**GET /~sgtatham/putty/latest/x86/pscp.exe HTTP/1.1
Host: the.earth.li
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20100101 Firefox/13.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
\.+"
GET /~sgtatham/putty/0.62/x86/pscp.exe HTTP/1.1
Host: the.earth.li
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20100101 Firefox/13.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Content-Length: 315392
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: image/jpeg**
Platform: Digital Engagement Platform; Version: 1.1.0.0