What is the efficient and straightforward code for finding array elements in a string. For example:
a = Array['aaa', 'bbb', 'ccc', 'ddd', 'eee']
b = "This is the sample string with aaa , blah blah"
c = someFunction(b, a)
puts c
=> ['aaa']
Suppose a array have 100 elements, I want to know which of array element is found in the string. I should match exacct word. So xbbb, bbaa, ... not matched.
'aaa'?ain your stringb. Also, please make clear whether"xbbb", if it were in the string, would be a match.