![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Words, no consecutive doubled letters but repeated lettersby wlegrand (Initiate) |
on Oct 27, 2022 at 19:01 UTC ( #11147753=perlquestion: print w/replies, xml ) | Need Help?? |
wlegrand has asked for the wisdom of the Perl Monks concerning the following question: 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;' filenThis 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.</>
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
Back to
Seekers of Perl Wisdom
|
|