Skip to content

Instantly share code, notes, and snippets.

@atoponce
Last active January 18, 2022 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atoponce/60e3497519e36fefb0bd04a581daa939 to your computer and use it in GitHub Desktop.
Save atoponce/60e3497519e36fefb0bd04a581daa939 to your computer and use it in GitHub Desktop.

Start with "STAIN".

stain

The letters "S", "T", "A", and "N" are not in the final word. "I" is in the correct position.

Use the following regular expression:

$ grep -P '^[^stan][^stan][^stan]i[^stan]$' /usr/share/dict/words

Choose "MOVIE":

movie

The letters "M", "O", "V", and "E" are not in the finial word.

Add those hints to the current regular expression

$ grep -P '^[^movestan][^movestan][^movestan]i[^movestan]$' /usr/share/dict/words

Choose "FLUID":

fluid

The letters "F", "U", and "D" are not in the final word. The letter "L" is in the wrong position.

Add those hints to the currewnt regular expression:

grep -P '^[^fudmovestan][^fludmovestan][^fudmovestan]i[^fudmovestan]$' /usr/share/dict/words | grep l

Choose "LYRIC":

lyric

We won.

finished

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment