static readonly Regex surNameRegex = new Regex(@"[A-Z].+?\s([A-Z].+)", RegexOptions.Compiled); public string GetSurname(string fullName) { var match = surNameRegex.Match(fullName); if (match == null) { return fullName; } return match.Groups[1].Value; }
255800cookie-checkC# Get surname from full name