Instantiate a Regex object with the pattern and then call instance methods:
using System;
using System.Text.RegularExpressions;
class Program
{
static void Main(string[] args)
{
Regex r = new Regex(@"test?");
Console.WriteLine(r.Match("test"));
Console.WriteLine(r.Match("tests"));
}
}
The output:
test
test