vb.net 简单的替换字串

我有一个字串
我有一字串,这个字是由AAAA .... BBBBB
中间为任意字串

我要把中间的字串换成CCCC

比如 AAAA BBDDFEFEDF BBBBB other word
AAAA BBDDFEessefFefEDF BBBBB other word2

-->希望结果 AAAA CCCC BBBBB other word

这样

Dim s As String = ...
s = Regex.Replace(s, "(?<=AAAA).*?(?=BBBBB)", "CCCC")

忽略大小写

Imports System.Text.RegularExpressions

Module Module1

    Sub Main()
        Dim s As String = "AAaA BBDDFEessefFefEDF BBBBB other word2"
        s = Regex.Replace(s, "(?i)(?<=AAAA).*?(?=BBBBB)", "CCCC")
        Console.WriteLine(s)
    End Sub

End Module

图片说明