bluesplay106 has asked for the wisdom of the Perl Monks concerning the following question:
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 :========== Name: blah ID: 2 ==========
I want the output to look like :while($regex =~ /=====.+?ID: 3.+?=====/igs) { print "$&\n"; }
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?========= Name: Hi ID: 3 =========
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex Issue
by choroba (Cardinal) on Aug 01, 2013 at 15:53 UTC | |
by bluesplay106 (Novice) on Aug 01, 2013 at 16:01 UTC | |
by CountZero (Bishop) on Aug 01, 2013 at 17:42 UTC | |
by 2teez (Vicar) on Aug 01, 2013 at 17:47 UTC |