I’m trying to create a “scrabble-solver” to run stress-tests on a scrabble-like game I’m developing. I have a database containing ~200.000 words and I’m now looking for a way to match the scrabble tiles given with the words in the database.
Example:
Given tiles: A, P, E, F, O, L, M
Result: APE, POLE, PALE, MOLE, PAL...
Is this possible by using a simple SELECT-statement with REGEXP? If possible I would also like to add letters on specific positions and be able to determine max/min length.
I hope this question made sense 🙂
I’ve been googling my eyes out but I can’t seem to find what I’m looking for. Anyone got an idea?
Thanks! 🙂
It doesn’t sound like a regex problem. I think you’ll be better off simply creating all possible combinations of letters from the existing tiles and then running your SELECT statement with the IN clause. For example, with tiles:
your SELECT clause will be
You’ll get the list of valid words from your table.