using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = "dog";
string input = "this is a dog.";
Match match = Regex.Match(input, pattern);
if (match.Success )
Console.WriteLine("'{0}' was found at position {1} in '{2}'.",match.Value, match.Index + 1, input);
else
Console.WriteLine("The pattern '{0}' was not found in '{1}'.",pattern, input);
}
}