Wordle, January 30, 2024

wordle grid 955

I solved 955 without any computerized help, but I think my second-to-last guess can generate an interesting regular expression.

Wordle 955 screen shot

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:

  1. An e has to appear in one of columns 1, 2
  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, the l has to appear in column 5.
  • If an l appears in column 1, the e 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:

  1. Dealing with yellow letters is tricky. I’m still not sure regular expressions can handle yellow letters correctly 100% of the time.
  2. It’s impossible to think of x as a letter in a guess. I only saw expel because I use x as a space filler. While working on a solution, I might type in xxpex in the fifth row to give me a form to imagine where to substitute candidate letters.
  3. It’s difficult to see the interactions of yellow letters. I didn’t notice the e and l interference until I was writing this very article.