从特定字符串中删除字符串到特定字符串

时间:2016-03-21 13:36:01

标签: c# string

我有一个像这样的字符串

string test = "aaaaa start bbbbbbb end ccccccc start dddddd end";

我想删除" start"之间的所有字符。和"结束"字符串,因此结果字符串将如下所示

result = "aaaaa startend ccccccc startend";

1 个答案:

答案 0 :(得分:2)

这样的事情:

Regex.Replace("(?<=start)(.*?)(?=end)", string.Empty);