問題:無法識別的轉義\ m在正則表達式中傳遞;標誌着< - 在./build.pl線的位置以米/.*?/ 890無法識別的轉義 m在PERL中通過正則表達式v5.10.1
856 sub addProperity {
857
858 my ($line,$inprop,$newpom,$depver,$artifactId,$thisartifactId,$br,$paramvalue,$masterpomversion) = @_;
859
860 my $alllines;
861
862 if ($$inprop) {
863
864 (my $thisline = $line) =~ s!\r!!;
865 chomp $thisline;
866
867 $thisline =~ s%<!--.*?-->%%g;
868 $thisline =~ s%<!--.*%%;
869 $thisline =~ s%.*-->%%;
870
871 $$inprop = '' if ($thisline =~ m!</properties>!);
872 $thisline =~ s%<.{0,1}properties>%%g;
873 $thisline =~ s%\s*$%%;
874
875 while ($thisline) {
876 #print "thisline=$thisline"."XX\n";
877 (my $propname = $thisline) =~ s!\s*<(.*?)>.*!$1!;
878 if ($propname =~ m!.group\s*!) {
879
880 (my $propvalue = $thisline) =~ s!.*<$propname>(.*?)</$propname>.*!$1!;
881 if ($propvalue =~ /\s*com.alcatel.axs.(.*)\s*/) {
882
883 my $groupId=$1;
884 my $thisversion=getThisVersion($depver,$groupId,$artifactId,$thisartifactId,$br,$paramvalue,$masterpomversion);
885 push (@{$newpom}, '<'.$propname.'.repversion>'.$thisversion.'</'.$propname.'.repversion>'."\n");
886 }
887 }
888
889 my $currentline=$thisline;
890 $thisline =~ s!.*?</$propname>!!;
891 last if ($currentline=$thisline);
892 }
893 }
894 }
背景:
腳本工作正常的 - 的Perl v5.8.8專爲i386- Linux的線程多,但
不工作的Perl - 爲x86_64的Linux的線程多
如果您認爲這有助於嘗試:您是否可以在更短的測試腳本中重現相同的錯誤?爲什麼或者爲什麼不?假設一個非常短的腳本除了消除具有指定屬性的字符,然後打印出剩下的文本外什麼也不做。 (順便說一下,是否有原因890行不使用'/ g' - 或者在你的情況下使用'!g' - 模式修飾符?) – thb 2012-08-04 19:33:24
看起來'\ m'被放入'$ propname'中'$ line'。然後將其嵌入到正則表達式中而不用引用。 '$ thisline'實際上在失敗之前究竟是什麼? – 2012-08-04 19:35:49
$ thisline ='something? apc.app.fwk \ components \ apc-a7324-plug \ src \ main \ resource \ plugin.xml>'; – user1576495 2012-08-04 19:51:01