[plug] scrabble regex

James Devenish devenish at guild.uwa.edu.au
Fri Jun 20 08:54:47 WST 2003


In message <000101c3366a$74494ce0$45c4becb at oemcomputer>
on Thu, Jun 19, 2003 at 09:55:31PM +0800, David & Lisa Buddrige wrote:
> Does any one know how to define a regex that matches a letter from a list of
> letters only once?

Presumably you will one day your will hold two copies of a particular
letter and will need to outgrow the initial regex anyway? Thus I don't
have a regex, but:

% apt-cache search anagram
an - Very fast anagram generator.
wordplay - anagram generator
% wordplay -lxs -n5 nacot
ACTON
CANTO
% wordplay -lxs -n6 nnacot
CANNOT
CANTON
CONANT
% wordplay -lxs -n4 -d1 nacot
COAT
CAN'T
NATO
ACTON
CANTO

Obviously this would not suit all scenarios in all word games, but might
work for some. You can feed your own wordlist to `wordplay`, if you
like. Haven't looked at `an`. If you need more, try a freshmeat search.
I know this doesn't have the same warm and fuzzy feeling as inventing a
unified regex (and maybe the other suggestions on the list will be
better for what you want to do) but since this is an "old" problem,
someone might have a pre-built solution out there.





More information about the plug mailing list