I'm making a Scrabble game with HTML and Javascript and I'd like to add a "hint word" feature based on the player's rack. I have a dictionary array with the valid words, and I need to test them against the players available tiles but I couldn't figure out how to do a regexp that gives me the following output:
Lets say the player has D-G-O-G-I-*-E tiles and the Regexp should return:
doggies = True (because of the wildcard) gore = True dog = True god = true dodge = false (because D appears only once)
It doesn't matter the order, only the letters and the times that letter is repeated
I've already tried building it with the valid letters like this /[DGOGIE]/ in regexpal.com but it didn't work at all I also tried playing with this (?=.*a)(?=.*b)(?=.*c) but still no result
I'm not quite sure how you would do this with regex, but here is the solution that @Felix described:
(Sorry if I answered too late)