Wordle and grep

Last Monday’s Wordle word was LIGHT. Lots of people had trouble with this one because their guesses led them to it from the back end, and they got caught up trying FIGHT/MIGHT/NIGHT/RIGHT/SIGHT. All of which are perfectly reasonable words, but there are so many of them.

I managed to get it in two, mainly because of a lucky first guess.

Wordle LIGHT

Later that day, I started to think that LIGHT might have been the only possible solution, given Wordle’s grading of LATER. And I figured I could prove—or disprove—that by using grep and the list of five-letter Scrabble words I wrote about in my earlier Wordle post. Here’s how I built up my grep pattern, one slot at a time. I’m using egrep because I can never remember what needs to be escaped in “basic” regular expressions.1

Obviously, I start with L:

egrep l

I figured the second letter had to be a vowel. Although LLAMA is a legitimate word, I refused to believe Wordle would be so evil as to have two repeated letters. And even if it were, the A had already been eliminated. So that set the second slot:

egrep l[iouy]

The third slot couldn’t be a T or any of the eliminated letters:

egrep l[iouy][^aert]

Now I was faced with the T being in either the fourth or fifth position. Instead of trying to come up with a complicated pattern that handled both cases, I decided to use two simple patterns: one with the T in the fourth spot and one with it in the fifth. With the T in fourth spot the full command was

egrep l[iouy][^taer]t[^aers] scrabble5.txt

where you’ll notice that I didn’t allow S in the last spot. This is because, despite what I said about the prevalence of plurals in Scrabble words, a month of playing Wordle has led me to believe that plurals aren’t used. They’re allowed in guesses, of course, but I’ve never seen a plural solution.2

The output was


I doubt that Wordle would use LINTY, but LOFTY and LUSTY are pretty good words. So I’d already disproved my hypothesis about LIGHT. Continuing on with the pattern that had T in the final position,

egrep l[iouy][^taer][^aer]t scrabble5.txt

the output was


LICHT is beyond the pale, and I had my doubts about Wordle using LICIT, but LIMIT is a perfectly good word. So that’s three or four words other than LIGHT that could have been the solution. I just wasn’t thinking straight when I convinced myself that my first guess had locked in LIGHT.

On Thursday I got my comeuppance, as I flailed around trying to get the letter in the fifth spot:

Wordle SHARD

Lucky for me there aren’t as many SHAR_ words as there are _IGHT words.

By the way, I decided to check if LLAMA truly is the only five-letter word that starts with L and another consonant. Turns out I was wrong about that, too.

egrep l[^aeiouy]... scrabble5.txt



Although I can’t believe LLANO or LWEIS would ever be a solution. And not just because LWEIS is plural.

  1. Please don’t write to tell me about ack or ag or ripgrep or any of the other improved greps. Their advantages—and I don’t dispute that they have advantages—don’t mean enough to me to switch from the familiarity of egrep

  2. Yes, of course I could go through the list of solution words in the JavaScript source code to confirm this belief, but that’s outside my code of Wordle ethics.