使用perl我已經包含下面的文本大文件「咕嚕咕嚕」,我試圖捕捉到文件中的所有正則表達式匹配$1
我給出的正則表達式。我的正則表達式是Perl的正則表達式啜食捕捉
=~ /((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
我不明白你想要捕捉什麼。你能告訴我們你期望輸出是什麼嗎? – 2012-07-07 05:46:46