How can I catch all possibilities of multiple words like "blue", "old" and "car" with one regex pattern?

blueoldcar
oldcarblue
carblueold
bluecarold
...

Comments

ajwall’s picture

This will catch the permutations, but with false positives.

("blue"|"old"|"car"){3}

To exclude false positives like "blueblueblue" with a single regular expression, you would have to explicitly include each permutation.