I don't know about golfing it down, but in terms of presenting a human-readable regex, it would somehow seem more intelligible to me if the whitespace were arranged differently:
/^ (.)(?!\1) # any character not followed by itself (.)(?!\1|\2) # any character not followed by itself or previous (.)(?!\1|\2|\3) # likewise unique... (.)(?!\1|\2|\3|\4) (.) \3 (?!\1|\2|\3|\4|\5) # 6th character must be same as 3rd (.)(?!\1|\2|\3|\4|\5|\6) # 7th and 8th must be unique . $/x
(Admittedly, it's still a bit of a mind-bender.)

Of course, having that handy regex generator makes the regex formatting and commentary a moot point -- so much nicer to allow people to use the simple "rhyme-scheme" alphabetics for specifying the target pattern, and keep the actual regex syntax a purely "script-internal" detail, hidden from human eyes.


In reply to Re^2: Regex help by graff
in thread Regex help 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.