【发布时间】:2011-06-16 21:30:05
【问题描述】:
我想将所有匹配项放入一个集合中,或者至少是一个新字符串,其中我的值由空格分隔。
var srcString = @"foo foo %%match1%%, foo %%match2%%, %%match3%% foo foo";
var output = Regex.Match(srcString, @"\%\%(.*)\%\%").Groups[1].Value;
其中输出必须是一个集合,其中“match1”作为元素,“match2”作为下一个元素,依此类推,或者至少类似于“match1 match2 match3”。
谢谢!
【问题讨论】:
标签: c# regex string c#-4.0 collections