给定以下代码:
var myList = new List<string> { "red shirt", "blue", "green", "red" };
Regex r = new Regex("\\b(" + string.Join("|", myList.ToArray()) + ")\\b");
MatchCollection m = r.Matches("Alfred has a red shirt and blue tie");
我想要包含的结果,m
因为"red shirt", "blue", "red"
所有这些都在字符串中,但我只得到"red shirt", "blue"
. 我可以做些什么来包括重叠?