Possible Duplicate:
Check if multiple strings exist in another string
Say I have a list of allowed words/phrases:
'Stack'
'Overflow'
'Stack Overflow'
'Stack Exchange'
'Exchange'
and the following text to parse:
'Hello, and welcome to Stack Overflow.
Here are some words which should match: Stack, Exchange.'
I'd like to get the list of words which are found in the allowed list:
- 'Stack Overflow'
- 'Stack'
- 'Exchange'
What would be the best way to achieve the result?
The allowed list I'll be using could be at least a thousand words/phrases.