[plug] scrabble regex

David & Lisa Buddrige buddrige at wasp.net.au
Thu Jun 19 21:55:31 WST 2003


Hi all,

I am trying to write a program tht will assist with games such as scrabble,
bogle, and various other word-games.  I have a dictionary of several tens of
thousands of words that I got from the linux ispell dictionary and I was
using a regular expression to match the words that can be made from the
letters I have available.

My problem is, I can't figure out how to match only one instance of each
letter that I specify.  For example, If I have the letters "o" and "l", it
picks up "loo" or if I have "nacot", it will pull out "cannot" even though I
only have one "n".

I have tried the following regex's:

^([letters]){2,num-letters}$

and

^[letters][letters][letters][letters]$

but I still have the problem of using a letter more than once...

Does any one know how to define a regex that matches a letter from a list of
letters only once?

cheers

David.



More information about the plug mailing list