|Pathologically Eclectic Rubbish Lister|
Question about regex.by that_perl_guy (Initiate)
|on Sep 29, 2020 at 02:10 UTC||Need Help??|
that_perl_guy has asked for the wisdom of the Perl Monks concerning the following question:
I will be extremely thankful if the monks here could help me understanding regex in Perl.
Suppose I have a text file that has these lines:
If the record contains the word "third" our "four", I want it to print the whole record, meaning the stuff between the empty lines, not just lines with those words in it. But I am not able to write it correctly. Here is what I have tried:
And it prints:
But what I want is:
Where am I going wrong? Please guide. Please note, this is just an example. Depending on the data supplied the other lines in the file may contain some different words.
Not sure if this matters, but I'm on Windows 10 with Strawberry Perl version 5.32.