[plug] scrabble regex
Craig Dyke
grail at westnet.com.au
Thu Jun 19 22:59:11 WST 2003
On Thu, 2003-06-19 at 22:43, Ryan wrote:
> On Thu, 2003-06-19 at 21:55, David & Lisa Buddrige wrote:
> > 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 ?
I think I am probably missing the point as 'loo' does contain an 'l'
and an 'o' so therefore should be returned.
But, if your saying that if you want to use 'l' and so if any other
letter is on either side ignore what about:
\W[letter]\W
\W = [^a-zA-Z_0-9]
Just a suggestion :)
Craig
More information about the plug
mailing list