I'm using the Wordle game to improve my regex skills by searching a 5 letter English word list using regex. The concept of the game that matters for this question is that the picture below shows information about a 5 letter US/English word. The grey letters do not appear in the word. The yellow letters appear in the word but not in the position indicated. I've developed a regex that solves this puzzle but it doesn't "look right" to me, and I'm wondering if there is a more efficient and/or compact way to express myself?
| T | R | A (y) | C | K |
| F | I | E (y) | L | D |
| J | U (y) | M | P (y) | S (y) |
(y) = Yellow square
Here is my regex solution:
^(?=.{0,5}u)(?=.{0,5}e)(?=.{0,5}a)(?=.{0,5}p)(?=.{0,5}s)[^trckfildjm][^utrckfildjm][^aetrckfildjm][^ptrckfildjm][^strckfildjm]$
Note that for the second position I indicate (in addition to all the grey characters) that the letter "u" cannot be found there. The third position doesn't include "a" or "e", etc.
My main area of interest: I'm doing five independent character lookaheads, and I wonder if that could done more compactly or efficiently? Any suggestions for optimization or clarity would be welcome. Here's a regex sample with sample search word list to demonstrate fully: https://regex101.com/r/NkjXH9/1
