I’m a little happier with my wordle-solving regular expression today.
I made 4 guesses, resulting in this:
At this point, I could not come up with any solution at all for my 5th guess. So I wrote a Linux “pipeline” to give me some hints. The interesting part is the regular expression that any 5-letter solution should match.
grep '^.....$' /usr/share/dict/words | tr '[A-Z]' '[a-z]' | egrep '[^craemoldystkwi][^craemoldystkwi]ngi|i[^craemoldystkwi]ng[^craemoldystkwi]'
Linux pattern matching utility
egrep lets you use “alternation”,
“this pattern OR that pattern”.
For the Wordle grid above, I could specify that the solution must
either not have an ‘i’ in the initial position and must have an ‘i’
in the final position,
the solution must have an ‘i’ as the first letter,
but not as the final letter.
I tried to justify this assumption to write this post,
but I can’t.
I think I wrote an overly strict regular expression
based on the 2 yellow ‘I’ squares in the 4-guess partial game above.
I should not have limited the accepted words with the
I’m not sure it matters, the above pipeline did give me a single solution.