Mega Code Archive

 
Categories / C# / Development Class
 

Is match successful

using System; using System.Text.RegularExpressions; public class Example {    public static void Main()    {       string input = "this is a test";          string pattern = "is?";       Match match = Regex.Match(input, pattern);       while (match.Success)       {          Console.WriteLine("'{0}' found in the source code at position {1}.",                              match.Value, match.Index);          match = match.NextMatch();       }    } }