Reputation: 73
I'm developing a Perl script and one of the script functions is to detect many lines of data between two terminals and store them in an array.
my @statistics_of_layers_var;
for( <ALL_FILE> ) {
@statistics_of_layers_var = ($slurp =~ /(Statistics\s+Of\s+Layers)(\n|.)*(Summary)/gm );
print @statistics_of_layers_var;
The given data should be
Statistics Of Layers
Line#1
Line#2
Line#3
Summary
In this piece of code, code successfully prints Statistics Of Layers and Summary but it fails to print all data between those two terminals.
How could I fix this issue?
Upvotes: 1
Views: 52
Reputation: 67978
(Statistics\s+Of\s+Layers)((?:\n|.)*)(Summary)
Try this.See demo.
https://regex101.com/r/mT0iE7/7
Upvotes: 1