Looking for .net Keywords? Try Ask4Keywords

.NET Framework Найти все совпадения


пример

С помощью

using System.Text.RegularExpressions;

Код

static void Main(string[] args)
{
    string input = "Carrot Banana Apple Cherry Clementine Grape";
    // Find words that start with uppercase 'C'
    string pattern = @"\bC\w*\b";

    MatchCollection matches = Regex.Matches(input, pattern);
    foreach (Match m in matches)
        Console.WriteLine(m.Value);
}

Выход

Carrot
Cherry
Clementine