using System; using System.Linq; using System.Collections.Generic; using System.Text.RegularExpressions; public class Test { public static void Main() { var strs = new List {"this is a test for <> who like <>", "test 2 <> likes nothing", "test 3 <> <> <> <> <> <> <>." }; foreach (var s in strs) { var results = Regex.Matches(s, @"<<(.*?)>>", RegexOptions.Singleline) .Cast() .Select(x => x.Groups[1].Value); Console.WriteLine(string.Join(", ", results)); } } }