Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: regex for word puzzle

by Anonymous Monk
on May 17, 2011 at 02:46 UTC ( [id://905194]=note: print w/replies, xml ) Need Help??


in reply to Re: regex for word puzzle
in thread regex for word puzzle

Assume your rack is rtesamcna. Assume also you have the list of valid words in TWL.txt. The following grep command will show you words formed using only letters in your rack, but it will use any number of the letters:

grep -i '^[rtesamcna]*$' TWL.txt

Not quite what you want. You don't want words with more than 1 R, or more than 2 A's. So we filter it out:

grep -i '^[rtesamcna]*$' TWL.txt | grep -iEv 'r.*r|t.*t|e.*e|s.*s|a.*a.*a|m.*m|c.*c|n.*n'

And finally, to show anything with at least 9 letters:

grep -i '^[rtesamcna]*$' TWL.txt | grep -iEv 'r.*r|t.*t|e.*e|s.*s|a.*a.*a|m.*m|c.*c|n.*n' | grep ...... +...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://905194]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-16 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found