Returns a new Match object with the results for the next match, starting at the position at which the last match ended
using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = "a*";
string input = "abaabb";
Match m = Regex.Match(input, pattern);
while (m.Success) {
Console.WriteLine("'{0}' found at index {1}.",
m.Value, m.Index);
m = m.NextMatch();
}
}
}
Related examples in the same category