Answers.
  1. Do you find /x regexes easier to read/understand, or harder?
    In the real world? Generally harder. But some complex/tricky ones benefit.
  2. Does this "ease of reading" change one way or the other as you gain experience with regexes?
    Yes. When you don't understand them, the comments can help. They are a great learning tool for explaining how an RE works. But they are a crutch, and like real crutches, they bang your legs when time comes to start running.
  3. What kinds of rules should be followed when using /x to ensure the best readability?
    My rule is that if I feel tempted to use /x, then that is a sign I need to refactor my problem. Instead of single massive regexes, I like to have straightforward regexes together with higher-level looping logic. For this pos is quite useful to know about.
Summary: I think /x is a wonderful idea, which I am very glad exists and is excellent for teaching. (Indeed the inspiration came from trying to teach someone.) But using it in production code violates the rule of trying to only maintain one document. If you can read the RE directly, then the comments are superfluous at best, and misleading at worst.

For anyone who doesn't believe that comments in the wrong place can be misleading, I invite you to read Things are not what they seem like. again. And this isn't just a bizaare obfuscation technique, in the real world overly verbose commenting is a very common way for well-meaning people to produce unmaintainable messes...


In reply to Re (tilly) 1: Proper use of //x by tilly
in thread Proper use of //x by swiftone

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.