I have a long list of words in an array. Some short, some long. I'd like to filter out those words which starts with a word from the array (length of this "prefix" word can be set to, say, 3 characters) and which at the same time ends with a word from it.
Let's say the first word is 'carport'. Now, if 'car' and 'port' exist in the array too I would get a match. But if the word is 'carlsberg' I wouldn't get a match (since 'lsberg' probably wouldn't be an existing word in the array).
Results would preferably come out as "prefix word, suffix word, whole word".
I'd consider using any language that can make me do this, although I'm mostly a JavaScript guy myself.