I want to match a string to a specific pattern or set of words, like below:
the apple is red is the query and
the apple|orange|grape is red|orange|violet is the pattern to match.
The pipes would represent words that would substitute each other. The pattern could also be grouped like [launch app]|[start program]. I would like the module to return True or False whether the query matches the pattern, naturally.
What is the best way to accomplish this if there is not a library that does this already? If this can be done with simple regex, great; however I know next to nothing about regex. I am using Python 2.7.11