From: Daniel Finnie Date: 2007-01-08T09:32:25+09:00 Subject: Re: [QUIZ] Word Blender (#108) Here is a version of the regex that works around that: regex = /^([a-z])(?!\1)([a-z])(?!\1|\2)([a-z])(?!\1|\2|\3)([a-z])(?!\1|\2|\3|\4)([a-z])(?!\1|\2|\3|\4|\5)([a-z])$/ Some examples: >> regex.match 'abcdef' => # >> regex.match 'abcdefg' => nil >> regex.match 'abcddf' => nil >> regex.match 'abbdtf' => nil >> regex.match 'Abbdtf' => nil >> regex.match 'awesom' => # >> regex.match 'hollow' => nil Fedor Labounko wrote: > On 1/7/07, Daniel Finnie wrote: > >> # Find words that use the same letters >> selectedWords = dict.scan(/^[#{baseWord}]{3,6}$/) > > > I was really impressed when I first saw this. It doesn't quite work if you > want to exclude reusing the same letter more than once > ("hhh".scan(/^[hello]{3,6}$/) => ["hhh"]) but it comes so close to > something > I've only ever thought about implementing as a recursive method. > Unfortunately I don't know much about this but now I wonder if it's > possible > to find all partial permutations of a word with a regexp. >