So I have a big text file that follows this pattern :
==========
Name: blah
ID: 2
==========
and this repeats multiple times in the text file.
I want to regex anything between the "=======" but only such that ID is say 3.
I tried the following :
while($regex =~ /=====.+?ID: 3.+?=====/igs) {
print "$&\n";
}
I want the output to look like :
=========
Name: Hi
ID: 3
=========
But I end up with the whole text file or at least it might be grabbing anything before ID: 3 and after the first "======", but I can't tell since the output is so large. I think that's what it might be doing. Also, what if there are more than one instance of ID: 3? Is there anyways I can print all those instances without printing the whole file? Can anyone help me?