It's like regularly using strict (incidentally, yet another default that has been changed in more recent versions of Perl).

Firstly, I agree with the move to safe defaults. I may even have had some influence on changing the only mind that matters in that regard with strict. I'm not certain of course, but the change did come shortly after that discussion.

I'd rather adapt the language defaults to the way its users actually think

I'm in favour of that also. But the crux of our disagreement is whether your assessment of how they think is correct. And I believe you are not.

As you've agreed that the vast majority of uses of regex are against single line strings, I find it strange that you don't see that when they describe /^foo/ as "foo at the start of the line" that they aren't simply assuming -- with good cause -- that the 'start of the line' and the 'start of the string' are the same thing. Analogously ditto for the other two. Because with single line strings, that is so.

The fact that their wordy description isn't factually correct when dealing with multi-line strings doesn't change the fact that it is a good assumption for the majority of uses.

And once they start dealing with multi-line strings -- if they ever do -- there are other things that must be taken into serious consideration in addition to those three. And in my uses of dealing with multi-line strings I've usually found that I need to make explicit provision for dealing with newlines. That is to say, I explicitly don't want '.'s to match through newlines; but rather want to use embedded newlines to restrict the scope of preceding wildcards.

I can see we'll not agree here, but I still think that it is better for people to apply both /s & /m on the basis of need rather than as a 'it comes as recommended' cargo cult.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?


In reply to Re^9: example of 'm / / m' related example and compare to 'm / / s' by BrowserUk
in thread PERL regex modifiers for m// by rockstar99

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.