Finding NPL Base Types

This page gives some brief examples of how to use the search tool to find words for certain flat types. It's unlikely to be much help to you unless you are willing to spend at least a few minutes trying to understand regular expressions. For that, I recommend you look at the reference page maintained at Cornell University.

The instructions in this page generally assume you are familiar with our A Regular Expression Primer, and that you are using the advanced search which allows you to use two criteria and to negate them, etc..


Suppose you want to transpose “aeginrst”. Put [^ganister] into the first search string, and specify “don't match”; then put \(.\).*\1 into the second search string, and specify “don't match” there, too. Then choose a word length of 8. If you use NI2 as your dictionary, this query will retrieve you three words: astringe, ganister and gantries, all of which are transposals of aeginrst.

This works because the first string, along with the “don't match”, says: “find all words that don't contain any of the letters other than aeginrst”. So only words that contain some or all of those letters will be returned. The second query says “don't match anything that has a repeated letter anywhere. Since aeginrst has no repeated letters, that's a requirement. Finally, the 8-letter length requirement forces every one of the 8 letters to be used, so that every returned word must be a transposal.

This won't work for transposals containing spaces, or if any letters are repeated. You can get an approximation to the list by omitting the second search string, though, and this is sometimes good enough.

(.).\1 May work better for you with the current code on the website.

Letter banks

What banks down to “lens”? Put [^lens] into the first search string and choose “don't match”; the result (using NI2) will be a list of 47 words, all of which contain only l's, e's, n's and/or s's. However, the list includes words like “eel” and “sense” which don't contain all four of the letters. The best that can be done here is to put …. into the second search string. This will force the resulting words to be at least four letters long, which eliminates “eel” but not “sense”.


Suppose that you suspect part of a consonantcy's solution is “biochemistry”. The consonants are bchmstr; you could search for bchmstr and specify “consonants only” but the resulting list won't tell you what words contained those consonants. Instead, put the following string: [aeiouy]*, which matches any number of vowels, between every consonant, and enter the result as the search string:


This works, but in addition to “beachmaster” (which is the one we wanted) it returns “psychobiochemistry”. This can be avoided by adding a ^ and $ around the pattern, like so:



You can find pattern words by using the back-referencing feature of regular expressions. Let's say a word in a crypt is KQFPWQP. Each letter that appears twice can be made into a back-reference:

^.(.).(.).\1\2$ May work better for you with the current code on the website.

As with letter banks, this isn't perfect: it returns alveole, which is good, but it also returns potoroo, which is not. There is no easy way to improve this; you just have to hope there aren't too many false positives in the list. For strongly patterned words this is not much of a problem; for weakly patterned words the list is likely to be very long anyway.

You can filter the result a little, though, by specifying in this case that no letter should repeat three times. You can do this by putting \(.\).*\1.*\1 in the second search string, and specifying “don't match”; this reduces the matches from 69 to 49, and eliminates potoroo.

(.).*\1.*\1 May work better for you with the current code on the website.
solving/wordlists/regex_examples.txt · Last modified: 2007/11/06 20:26 by kite
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki

All content is copyright © 1893-2017, National Puzzlers' League. All rights reserved. For permissions, apply to the editor.