Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想用空字符串替换这个块之间的所有内容,有什么更好的方法。在替换字符串之前,内容看起来像
Customer Request Message...... [[REQUEST_Data]] KEY=VALUE KEY=VALUE KEY=VALUE [[/REQUEST_Data]]
替换后的内容将变成客户请求消息...... [[REQUEST_Data]] [[/REQUEST_Data]] 之间的所有内容都必须替换为空字符串,并且两个标签也都替换为空字符串。
var regex = @"\[\[REQUEST_Data\]\](\n|\r|\r\n|.)*\[\[\/REQUEST_Data\]\]" var replaced = Regex.Replace(input, regex, "");