我有一个字符串,我希望从中提取一个单词,但附加了一个数字,每行可能不同:
This is string1 this is string
This is string11
This is string6 and it is in this line
我想解析这个文件并获取“stringXXX”的值,从 0 到 100
# suppose ABC.txt contains the above lines
FH1 = open "Abc.txt";
@abcFile = <FH1>;
foreach $line(@abcFile) {
if ($pattern =~ s/string.(d{0}d{100});
print $pattern;
上面打印了整行,我希望只得到 stringXXX