I have the following code:

 int numberOfWords = 50;
 string regexMatch = string.Format(@"^(\w+\b.*?){{" + numberOfWords + "}}");
 string firstWords = Regex.Match(result, regexMatch).Value;

This code displays the first 50 words in a string. Now I want to display next 50 words (51st word to 100th word). How do I do it?

Use Regex.Match(String, Int32) to start at a specific point in your string. Since you have the set of firstWords, you know how long they are and where to start the next search.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.