in reply to Re: Strange regex to test for newlines: /.*\z/
in thread Strange regex to test for newlines: /.*\z/
When the match is in /m mode .* will match anything BUT a newline. ( when in /s mode .* will match anything )
I assume what it is trying to match is one line.
So basically what this test does is :
"Between all characters (on this line) that are not newlines, and the end of the string, are there any other characters?", if so, it won't match. If it doesn't match, the only character that can cause it is a newline.
It does sound a bit like a roundabout way to get what you want though.
How about if ( $foo !~ /\n\z/ )
BTW. setting $/ has no influence on /m or /s whatsoever?
Not that I could find with experimentation.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Strange regex to test for newlines: /.*\z/
by Mutant (Priest) on May 21, 2007 at 14:02 UTC | |
|
Re^3: Strange regex to test for newlines: /.*\z/
by moritz (Cardinal) on May 21, 2007 at 14:02 UTC | |
by mrpeabody (Friar) on May 22, 2007 at 20:37 UTC | |
|
Re^3: Strange regex to test for newlines: /.*\z/
by betterworld (Curate) on May 21, 2007 at 14:32 UTC |