Try now in the
Open Cloud »
(no sign-in required)

# Find Letter Patterns

Find dictionary words that have interesting patterns of letters.

Run the code to find words that start with a and end with z. Try other letters:

DictionaryLookup returns dictionary words that match a pattern.

In a pattern, ___ stands for any sequence of zero or more letters.

This returns dictionary words that start with a, followed by zero or more letters, followed by z:

 In[1]:= XDictionaryLookup["a" ~~ ___ ~~ "z"]
 Out[1]=

 In[1]:= XDictionaryLookup["a" ~~ ___ ~~ "z"]
 Out[1]=

Find words that contain kk. Try other letters:

Patterns can contain any combination of letters and blank sequences, including more than one blank sequence.

This returns words that contain kk somewhere in them:

 In[1]:= XDictionaryLookup[___ ~~ "kk" ~~ ___]
 Out[1]=

 In[1]:= XDictionaryLookup[___ ~~ "kk" ~~ ___]
 Out[1]=

Find words that contain all the vowels in order. Try other letter patterns (like the letters of your name):

Are there any words that contain all of the vowels in sequence? Use DictionaryLookup to find out:

 In[1]:= XDictionaryLookup[___ ~~ "a" ~~ ___ ~~ "e" ~~ ___ ~~ "i" ~~ ___ ~~ "o" ~~ ___ ~~ "u" ~~ ___]
 Out[1]=

Here are the words that contain the letters of Stephen in order and share its first and last letters:

 In[2]:= XDictionaryLookup[ "s" ~~ ___ ~~ "t" ~~ ___ ~~ "e" ~~ ___ ~~ "p" ~~ ___ ~~ "h" ~~ ___ ~~ "e" ~~ ___ ~~ "n"]
 Out[2]=

 In[1]:= XDictionaryLookup[___ ~~ "a" ~~ ___ ~~ "e" ~~ ___ ~~ "i" ~~ ___ ~~ "o" ~~ ___ ~~ "u" ~~ ___]
 Out[1]=

Find words that start and end with the same three letters. Try other letter patterns:

If a named pattern like x_ occurs more than once in a pattern, every occurrence has to match the same letter(s). This pattern matches words that start and end with the same three letters:

 In[1]:= XDictionaryLookup[x_ ~~ y_ ~~ z_ ~~ ___ ~~ x_ ~~ y_ ~~ z_]
 Out[1]=

Find words that repeat the same sequence of letters twice:

 In[2]:= XDictionaryLookup[x___ ~~ x___]
 Out[2]=

 In[1]:= XDictionaryLookup[x_ ~~ y_ ~~ z_ ~~ ___ ~~ x_ ~~ y_ ~~ z_]
 Out[1]=