Assume I have the following list of companies:
- Big Apple
Then I have this sample string:
Big Apple is a company that is trying to be the next Google.
Given the list of companies and the sample string above, how can I find the list of companies in the sample string?
If I iterate through the list of companies and search for it in the sample string, I would find three matches: Apple (because "Apple" exist in "Big Apple"), Big Apple, and Google. In my scenario, I wouldn't want just Apple to match since Big Apple is a more accurate match.
I'm trying to implement the solution in PHP, but a general description/strategy on how to solve this would be helpful.