【发布时间】:2017-05-25 06:57:39
【问题描述】:
我将从 href="download.php?id=469979" 中提取此“OutDaughtered.S02E03.A.Quint.In.Crisis.720p.TLC.WEBRip.AAC2.0.x264-BTW.torrent”
<a class="index" href="download.php?id=469979"><img src="styles/images/download.png" style="position:relative;bottom:1px;" alt="Download" border="0"> OutDaughtered.S02E03.A.Quint.In.Crisis.720p.TLC.WEBRip.AAC2.0.x264-BTW.torrent</a>
我有这个代码:
# Search for filename
my $match_filename=qr/<a class="index" href="download.php\/.*?\/.*?.torrent"><font color=.*?>(.*?).torrent<\/font><\/a> .Press/ms;
my $filename_matches=$r->match('filename', $match_filename);
if($filename_matches==0){ $r->err('Can not continue without filename, aborting!'); return 0;}
my $filename=@$filename_matches[0];
$r->err("Filename: $filename");
我有这个错误:
Failed to match filename
Can not continue without filename, aborting!
谢谢
【问题讨论】:
-
现在说什么?你想做什么,为什么要做,想要达到什么结果?
-
目前还不清楚您实际问的是什么。 “将 html 转换为正则表达式”是什么意思?正则表达式是 search 模式,html 是标记代码。他们没有任何共同之处。你不能将它们“转换”成彼此。
-
也许您想要可以匹配该代码的正则表达式?请解释一下。
-
.*将转换 any HTML、any 文本.... anything ! -
我将从“href="download.php?id=469979"”中提取这个 OutDaughtered.S02E03.A.Quint.In.Crisis.720p.TLC.WEBRip.AAC2.0.x264- BTW.torrent