1 2 3 4 5 6 7
// using System.Text.RegularExpressions; private static int CountStrings(string str, string regexStr) { Regex regex = new Regex(regexStr); return regex.Matches(str).Count; }