That is the question I was asked at the real amazon interview. Unfortunately, I have not found such a problem on a leetcode to check the solution, so I post it here.
You have a list of regex expressions that can be either just a string like 'apple' or can have a star symbol like 'app*'. The task is to check if a given word matches at least one of the regex expressions. You may have thousands of regexes.
Note: start symbol can be only at the end of a string. The case 'app*store' is not possible.
Example 1:
Array of regexes: [app*, apple, app];
Given word: apple
Result: true - it matches regexes 'apple' and 'app*'
Example 2:
Array of regexes: [app, applestore, application];
Given word: apple
Result: false - it does not match any regexes