Re: [問題] 從email body中取出URL....
※ 引述《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)
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
Perl 近期熱門文章
PTT數位生活區 即時熱門文章