I need to find the repeated words exact index in a text. For example, refer the below text.
string text = "The first text area sample uses a dialog text to display the errors";
text.IndexOf("text");
In this string the word "text" is repeated twice. I need to get the index of both positions. If we using the "IndexOf" as in the above code will return the 10 always, which is the index of the 1st word "text". So, how do we find the exact index of the repeated words in a text using C#.