"Am I better running a..." has to be qualified with what your design goal is.

Regarding computational efficiency: Alternation is pretty efficient nowadays. But if there's a possibility of lots of backtracking, and that possibility can be avoided by breaking things up into smaller experssions, smaller expressions are the way to go.

If the goal is readability, smaller expressions are often the way to go, though to some degree that's mitigated with the /x option and judicious use of white space.

If the goal is easy debugging, I don't think there's much question that easier to digest chunks of regular expressions are going to be simpler to debug than a wall of regexp metamumbojumbo. (That even applies to people who have invested considerable time and effort in learning RE's inside and out as well as reading MRE, in my opinion.)


Dave


In reply to Re: Multiple Regex evaluations or one big one? by davido
in thread Multiple Regex evaluations or one big one? by flyerhawk

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.