Hi, I'm on Perl v5.18.2 but I would prefer to have this work with Perl v5.10 I can use Perl to find words in my Dictionary that have doubled letters in various positions using variations of this that I manually adjust to fit the word.

 perl -wnl -e '/(?i)\A(?=\w{10}\z)[a-z]{2}([a-z])\1[a-z]([a-z])\2/ and print;' filen

This will search for 10 letter words with doubled letters at positions 3, 4 and 6, 7. It has a letter pattern of abCCdEEfgh where C stands for the 3rd and 4th letter position and D stands for the 6th and 7th letter position. I get 181 words.</>

babbittess .......... yellowwort

Now I am searching for the type of word that is 12 letters long that has no consecutive doubled letters but has repeated letters. Ex. reservations which has a letter pattern of ABcBAefghijh where A stands for the 1st and 5th letter position and B stands for the 2nd and 4th letter position. There are 25,176 twelve letter words in my Dictionary and I need some way to extract the words that match that type of pattern. Perl can do any text manipulation but I can't. A one-liner or a script. I will adjust the one-liner or script manually for other pattern words. Can you help?

Willi


In reply to Words, no consecutive doubled letters but repeated letters by wlegrand

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.