Compare a string by word to an array to see how many words from the string show up in the array

Hello I have a situation where I have string such as “Sport Quad 8ft bed” and I have an array such as “Sport/Bike/Truck/Quad/Tri” and I need to get a count of how many times that a whole word from the array show up in the string for example this would be 2. However regex match is not working because it is matching character and not by word anyone have any ideas?

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Matches(yourString,String.Join("|",keywords.Select(Function(s) "\b"+s+"\b"))).Count

Sample20221129-2.zip (2.3 KB)

Regards,

This worked like a charm thank you

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.