I have a function that accepts 2 parameters.
Parameter 1: SearchTerm,
Parameter 2: ProductName
How do I check whether the words in SearchTerm exists in ProductName, doesn’t matter it occurs at the beginning, middle or end of ProductName?
It has to be word by word match, let say SearchTerm = “cano”, ProductName = “canon”, it should be return false, not match.
If you want to match only complete words you need word boundaries
\b, to add before and after your search term.\bis a zero width assertion that matches on a change from a word to a non-word character or from a non-word to a word character.Output: