using System; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Collections; using System.Linq; public class Test { public static void Main() { var phrases = new List { @"(one)", @".two.", "[three]" }; phrases = phrases.OrderByDescending(x => x.Length).ToList(); var pattern = $@"(?!\B\w)(?:{string.Join("|", phrases.Select(z => Regex.Escape(z)))})(?().Select(x => x.Value).ToList(); Console.WriteLine(string.Join(", ", matches)); } }