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?
You can use the same regex but starting after first 5o words. As you have first 50 words in firstWords so we have to start after these fifty words. So we will take substring of the result after fifty words which we have in firstWords. firstWords.Length will become new starting point for regex for second 5o words.