Wordle, January 30, 2024
I solved 955 without any computerized help, but I think my second-to-last guess can generate an interesting regular expression.
Ordinarily, I’d write a regular expression like this:
^[^cranstodbp][^cranstodbpl]pe[^cranstodbpe]$
The problem is that particular regular expression doesn’t include two facts:
- An
e
has to appear in one of columns 1, 2 - An
l
has to appear in one of columns 1 or 5
We can combine those two facts like this:
- If an
e
appears in column 1, thel
has to appear in column 5. - If an
l
appears in column 1, thee
can appear in columns 2 or 5.
Looks like a job for “alternation”, the logical “or” of two or more regular expressions:
^(lepe[^cranstodbpe]|l[^cranstodbpl]pee|e[^cranstodbpl]pel)$
A little Linux pipeline incorporating that fancy regular expression actually gives back a single word, “expel”, which is the answer to Wordle 955.
#!/bin/bash
set -eou pipefail
grep '^.....$' /usr/share/dict/words |
tr '[A-Z]' '[a-z]' |
grep -E '^(lepe[^cranstodbpe]|l[^cranstodbpl]pee|e[^cranstodbpl]pel)$'
Wordle 955, as I solved it, illustrates three things:
- Dealing with yellow letters is tricky. I’m still not sure regular expressions can handle yellow letters correctly 100% of the time.
- It’s impossible to think of
x
as a letter in a guess. I only sawexpel
because I usex
as a space filler. While working on a solution, I might type inxxpex
in the fifth row to give me a form to imagine where to substitute candidate letters. - It’s difficult to see the interactions of yellow letters.
I didn’t notice the
e
andl
interference until I was writing this very article.