in reply to Words, no consecutive doubled letters but repeated letters

/\A (?= [[:alpha:]]{12} \Z) (?! .* (.) \g-1) (?= .* (.) .+ \g-1)/x and print

But if you're scanning a dictionary, don't you know to begin with that all the words are words? It might be faster to scan with
    /\A (?= .{12} \Z) (?! .* (.) \g-1) (?= .* (.) .+ \g-1)/x and print
(OTOH, I know that some dictionaries include apostrophized and hyphenated words, so maybe you need to be specific. (Update: Upon further investigation, I find that the dictionary file I'm using does, indeed, include words like "wristwatch's", so [[:alpha:]]{12} vs. .{12} makes a difference for me.))

Update 1: Note that the regexes above need Perl version 5.10+ to support the \g{n} backreference operator.

Update 2: I second GrandFather's point about splitting up the components of a complex filter regex into individual regexes: they become simpler and easier to understand and manage, In that vein:

c:\@Work\Perl>perl -wMstrict -n -le "BEGIN { $::n = 0 } /\A .{12} \z/x && !/(.) \g-1/x && /(.) .+ \g-1/x and ++$::n and print; END { print \"$::n found\" } " ..\moby\mwords\354984si.ngl
(All the stuff with $::n is for development/debug only; it can be discarded for end use.)


Give a man a fish:  <%-{-{-{-<