I am working on a helper function to use with the New York Times online puzzle called Spelling Bee. I have been going in circles for a while, but I can’t seem to get the syntax right. Here is what I want to do.
Input: A string of English letters. Exact length doesn’t matter. Assume 7. For example “wdleano”
Output: A variable containing a string pattern, such as I would obtain by explicitly typing
z := "w" | "d" | "l" | "e" | "a" | "n" | "o"
Then I can construct a selection function such as
StringMatchQ[#, z ..] &
to apply to a list of words (such as Wordlist[]).
Conceptually, I want to Riffle Characters[the input word] with the | operator, but I can’t get the quotes to appear around the individual characters. I tried
Style[Characters["wdleano"], ShowStringCharacters -> True]
but then I get something with a head of Style rather than List, so I can’t feed it to Riffle. And I’m not sure how to handle the | operator in Riffle.
I’m sure I’m overlooking something simple, but I’m new to the Wolfram language. Please help.
Thanks. …RM