I have a string which contains, lets say word “key” 5 times. Each time I see the word “key” in that string I want to print some text. How can I parse that string, find all “key” words and print the texts accordingly? 5 words “key” – 5 printed texts. This needs to be done in C#.
Thanks in advance.
How about using
Regex.Matches:EDIT: If by “word”, you mean ‘whole words’, you need a different regex, such as: