I have a list of strings which are patterns with AND and OR operators and wildcards. Now given an input string, return true if it matches any patterns, and false if it does not.
Say, I have 'n' patterns and a query of length 'm' Now, the obvious way is to run a loop and grep for each pattern in the string. This takes O(nm) time.
Now, my question is, is it possible to do better? I was thinking some sort of expression evaluation Finite State Machine maybe? Is there a name/reference implementation of something like that?
Thanks