How to replace the text between two characters in c#

Use Regex with pattern: \{([^\}]+)\}

Regex yourRegex = new Regex(@"\{([^\}]+)\}");
string result = yourRegex.Replace(yourString, "anyReplacement");

Leave a Comment