using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Text.RegularExpressions; class MatchFullName { static void Main() { string input = "ivan ivanov, Ivan ivanov, ivan Ivanov, IVan Ivanov, Ivan IvAnov, Ivan Ivanov, Ivan IvanOV"; string pattern = @"\b[A-Z][a-z]+\s[A-Z][^A-Z][a-z]+\b"; Regex regex = new Regex(pattern); MatchCollection matches = regex.Matches(pattern); foreach (MatchCollection match in matches) { Console.Write(matches + " "); } } }