Re: [問題] 從email body中取出URL....

看板Perl作者時間16年前 (2009/02/12 13:13), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《deh3215 ()》之銘言: : 要取出www.xxx.xx或http://www.xxx.xx : 如果是html格式用LWP::Simple,或是HTML::LinkExtractor或是HTML::LinkExtor較好 : 如果是text格式,上述模組是否可行? 自問自答 從一堆文字中取出URL my $str3=" http://accounts.keybank.com/ConfirmHelp?start=yes Important information from Key Bank.This e-mail contains information directly related to your account Key Values Diversity .http://erasingines.nm.ru/singin.e-Bay.com.html KeyBank is an Equal Housing Lender .By accessing and using this website, you agree to http://adwords.google.com.session-19391027597041593339.17489801771251761326.com69.ru "; if (@num = $str3 =~ m{(https?://\S+)}ig) { #URL末端需有空白作結尾 foreach $tt(@num) { print $tt,"\n"; } 印出: http://accounts.keybank.com/ConfirmHelp?start=yes http://erasingines.nm.ru/singin.e-Bay.com.html http://adwords.google.com.session-19391027597041593339.17489801771251761326.com69.ru ※ 編輯: deh3215 來自: 140.117.168.75 (02/12 15:13)
文章代碼(AID): #19ax0KyO (Perl)
討論串 (同標題文章)
文章代碼(AID): #19ax0KyO (Perl)