Dear all!

I want to count the occourences of a variable based on a regex expression - counted by a group of variables.

E.g.:
ID1 ID2 text result
12 23 Hello 1
12 23 Bye 1
99 23 Hello 1
I have the two combining ID's "ID1" and "ID2" for a group, want to compare variable text with "Hello" and want a new column (result) with the numbers of "Hello"'s in this group.

My first idea was:
egen result=count(regexm(text, "Hello")), by(ID1 ID2)

or

egen result=count(text == "*Hello*"), by(ID1 ID2)

but both isn't working ...

Can you please help me?

Kind Regards
Simon