替换为模式匹配

Cor*_*rei 1 c# pattern-matching

如何使用该String.Replace功能使用模式?

我想做什么:

newTextBox = newTextBox.Replace("<Value> #'a string of any number of chars#' </Value>", 
                                "<Value>" + textBoxName + "</Value>");
Run Code Online (Sandbox Code Playgroud)

#'任意数量的字符串#'可以是任何字符串.

Tho*_*que 9

使用正则表达式:

newTextBox.Text =
    Regex.Replace(
        newTextBox.Text,
        @"<Value>[^\<]+</Value>",
        "<Value>" + textBoxName.Text + "</Value>");
Run Code Online (Sandbox Code Playgroud)