1. Do you find /x regexes easier to read/understand, or harder?

Generally harder. Regular expresions are generally a doddle to read, even if you have very little experience (see Lama Glama).

2. Does this "ease of reading" change one way or the other as you gain experience with regexes?

I don't know if it's just me, but I found that regexps quite easy from the start. I had never seen a /x until I saw one in some code I had to work on. It was no easier to read, and there to look flash, rather than improve the code.

3. What kinds of rules should be followed when using /x to ensure the best readability?

I tend to find that if I want to use /x, I should really be doing the job in some more code, not trying to do it in the expression. Code with comments is by far easier to read than a regexp with comments.

--

Brother Marvell


In reply to Re: Proper use of //x by marvell
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.