我在排序和提取多行文本時遇到了一些麻煩。這裏是我的代碼:如何使用Perl在此處提取多行代碼?
my $searched = $doc->content;
if($searched =~ /MODIFIED files in Task $_[1] : (.*?) The/gs){
print $1,"\n";
$Modified = $1;
}
if($searched =~ m/COMPILED in Task $_[1] : (.*?) The/ms){
$Compiled = $1;
}
if($searched =~ m/DELETED in Task $_[1] : (.*?) Comments/ms){
$Deleted = $1;
}
這裏的是文本文件的例子:
The following are the MODIFIED files in Task 50104 : **Directory Filename Version --------- -------- ------- Something Something ..... ...... ...... ..... ....... ........ .....** The following are the files to be COMPILED in Task 50104 : **Directory Filename --------- -------- ......... .........** The following are the files to be DELETED in Task 50104 : **Directory Filename --------- --------** Comments: Blah blah.......
凡之間的文本**是我想提取的東西。很抱歉的窮人格式化
上面是空行嗎?以下是......保證嗎? – Zaid