Text: Count the number of occurrences of different keywords


Due to confidentiality, I can’t show my exact text. But the main idea is I have a list of keywords, and I want to count each time anyone of them occur in a text. Thank you


Keywords: Sales, Revenue

Text: The Sales for 2020 is $4000 and the Revenue $5000. While the Sales for 2019 is $3000.

So the occurrences = 3

You can use regex matches activity. Pass In your key work as the regex pattern and it will return all instances of that match. You can then get the count of that.

You can use
Regex.Matches(str,Regex.Escape(“Sales”)).Count.ToString and Regex.Matches(str,Regex.Escape(“Revenue”)).Count.ToString so on to count the occurrences.

Hi Lokendra

Thank you for the reply. But the keywords are in separate regex expression.
I want to count ALL the keywords TOGETHER.

Thank you


I tried to amend the code to use OR operator in the Regex Match, but I get an error that “character is not valid”.

I want to count ALL the keywords TOGETHER. Thank you


@Anonymous2 Check this Workflow :
Count the Keywords.xaml (7.0 KB)

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