using System;
using System.Text.RegularExpressions;
publicclass Example
{
publicstaticvoid Main()
{
string pattern = @"gr[ae]y\s\S+?[\s|\p{P}]";
string input = "this is a test.";
MatchCollection matches = Regex.Matches(input, pattern);
foreach (Match match in matches)
Console.WriteLine(match.Value);
}
}