rhythmicus has asked for the wisdom of the Perl Monks concerning the following question:
Here's the test case:
while (<DATA>) { if (/(\d)\n{2}/) { print "$1\n"; } } __DATA__ Line 1 Line 2 Line 3 Line 5 Line 6 Line 7 Line 9
My question is, why does this not print:
3 7
As it stands, the script prints nothing. I know there are no \r or \f in the data, and just to be sure I tried matching against \W{2,}.
What am I missing here?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multiple newline regex
by ikegami (Patriarch) on Aug 31, 2004 at 18:18 UTC | |
|
Re: Multiple newline regex
by Roy Johnson (Monsignor) on Aug 31, 2004 at 18:18 UTC | |
|
Re: Multiple newline regex
by ysth (Canon) on Aug 31, 2004 at 18:19 UTC | |
|
Re: Multiple newline regex
by Fletch (Bishop) on Aug 31, 2004 at 18:19 UTC | |
|
Re: Multiple newline regex
by Velaki (Chaplain) on Aug 31, 2004 at 18:36 UTC | |
|
Re: Multiple newline regex
by rhythmicus (Sexton) on Aug 31, 2004 at 18:27 UTC |