Mega Code Archive

 
Categories / C# / Development Class
 

Returns a new Match object with the results for the next match, starting at the position at which the last match ended.t

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();       }    } }