Function ReplaceTest(patrn, replStr) Dim regEx, str1 ' 建立變量。 str1 = "The quick brown fox jumped over the lazy dog." Set regEx = New RegExp ' 建立正則表達式。 regEx.Pattern = patrn ' 設置模式。 regEx.IgnoreCase = True ' 設置是否區分大小寫。 ReplaceTest = regEx.Replace(str1, replStr) ' 作替換。 End Function