in reply to Re^6: example of 'm / / m' related example and compare to 'm / / s'
in thread PERL regex modifiers for m//
But that's what makes the defaults of ^ and $ so unfortunate. Because they happen to work okay most of the time (i.e. line-by-line), they only bite people when those people attempt something less usual and more intrinsically difficult (such as multiline parsing).
Without the options, any attempt to use a regex to match a multi-line string will fail early and obviously. With the options, you might get away without the understanding of what they do for a while, but eventually your misunderstanding will bite you, but instead of being immediately obvious, it will likely become a mysterious and difficult to debug transient failure.
Personally, I'd much rather that I got bitten by my misunderstandings the first time, or the first few times, I tried to do something that exposed that misunderstanding, than have only have it come to light when my cargo-culting mysteriously fails to match my actual requirements.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: example of 'm / / m' related example and compare to 'm / / s'
by Anonymous Monk on Dec 04, 2011 at 22:29 UTC | |
by BrowserUk (Patriarch) on Dec 04, 2011 at 23:07 UTC |