<分区>
我要List<string>
对于 [ ]
之间的所有字符串在字符串中:
Input = "[first] - [second] > [third] + 5"
所以我想要第一,第二,第三。
<分区>
我要List<string>
对于 [ ]
之间的所有字符串在字符串中:
Input = "[first] - [second] > [third] + 5"
所以我想要第一,第二,第三。
最佳答案
你可以这样做
List<string> lst=Regex.Matches(input,@"(?<=\[).*?(?=\])")
.Cast<Match>()
.Select(x=>x.Value)
.ToList();
关于c# - 如何找到两个已知值之间的所有字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13146974/