in reply to Re^5: /g option not making s// find all matches (updated)
in thread /g option not making s// find all matches
But that's the point: you never use anything other than an /xms tail in your own code.I dunno, that seems unnecessarily rigid. A "best practice" should mean "do this unless there's a good reason to do otherwise," not "always blindly do this no matter what." All three of those options modify the regex behavior. What if you need the unmodified behavior?
I realize "need" might be too strong a word; with /x, for instance, you can always just escape any literal space characters your regex needs. But if there are several of them, and your regex is otherwise simple, all those escapes clutter the code more than just omitting the /x. And someone else encountering m/a\ b\ c/xms in your code will wonder what tricky thing you're trying to do by telling the regex engine to ignore whitespace and then escaping all your whitespace.I'm not saying your system is wrong — I'm certain it serves you well — but I don't think I'm sold on it yet.
|Replies are listed 'Best First'.|
Re^7: /g option not making s// find all matches (updated)
by AnomalousMonk (Bishop) on May 31, 2018 at 21:21 UTC
by raygun (Scribe) on Jun 01, 2018 at 03:25 UTC