"... the modifiers xms ... would be better as:"

Well, I've seen some things taken out of context in my time but I think this one takes the biscuit. I'm not annoyed; I actually got a bit of a chuckle. I was, however, somewhat surprised.

Just so we're clear, let me highlight the seven words you pulled out of three sentences in order to get something to quibble about:

"I note that the modifiers xms are written in the same (alphabetically) unordered way as they appear throughout Perl Best Practices (PBP). So, either you've just copied those from somewhere else and don't know what they mean (see perlre - Modifiers) or you're required to follow PBP. If the latter, you should use warnings (see also -w in perlrun) and the regular expression would be better as:

My regex following "You can clean that up by ..." was:

/atg(.+?)(?:taa|tag|tga)/

That was my solution. I was happy with it. I'm still happy with it.

I then went on to say that if the OP was "required to follow PBP" then certain other things should be done. These included using warnings and making some changes to my regex. I wasn't advocating blind adherence to PBP and I don't believe anything in my post suggested that.

As far as the order of the modifiers goes: write them any way you want. PBP typically has xms (and, yes, that's the order in which they are presented in the book); I prefer to write them alphabetically (that's just me); to the best of my knowledge, the regex engine doesn't care what order you use.

Regarding the (?>pattern) construct, I claimed no advantage to using this. It's just another PBP guideline: "... rewrite any instance of: X | Y as: (?> X | Y )" [truncated extract from page 271].

Finally, you make a good point about "lower- (or canonical-) casing". I concur.

-- Ken


In reply to Re^3: Simple regex question. Grouping with a negative lookahead assertion. by kcott
in thread Simple regex question. Grouping with a negative lookahead assertion. by Anonymous Monk

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.