Roshan Srivastava
Roshan Srivastava

Reputation: 476

need help on regex or string replace

I want to replace all the content between this block with empty string,what's the better way to do it.Before replacing string the content would look like

 Customer Request Message......
[[REQUEST_Data]]
KEY=VALUE
KEY=VALUE
KEY=VALUE
[[/REQUEST_Data]]

After replacing the content would become Customer Request Message...... All the content between [[REQUEST_Data]] [[/REQUEST_Data]] must be replaced with empty string and also both the tag is also replace with empty string.

Upvotes: 0

Views: 67

Answers (1)

Jay
Jay

Reputation: 9592

var regex = @"\[\[REQUEST_Data\]\](\n|\r|\r\n|.)*\[\[\/REQUEST_Data\]\]"
var replaced = Regex.Replace(input, regex, "");

Upvotes: 2

Related Questions