给定一个文件名,我想将文件扩展名替换为“.org”。
我决定使用replace-regexp-in-string
函数:
(replace-regexp-in-string "\\(.*\\)\..*$" "\\1.org" "file.conserv.module")
输出:
"file.conserv.modul.org"
我认为它将返回"file.conserv.org",就像Perl程序中一样。
my $str = 'file.conserv.module';
$str =~ s/(.*)\..*$/$1.org/;
print $str;
我该如何获取“file.conserv.org”?