I have a string from which I wish to extract a single word, but with a numerical appended to it, which might be different in each line:
This is string1 this is string This is string11 This is string6 and it is in this line
I want to parse this file and get the values of "stringXXX", starting from 0 to 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;
The above prints the whole line, I wish to get only stringXXX
you need to capture it:
Explanation:
edit: fixed the order of the numbers that are captured.