I haven't tested this and forget the source (probably some post on SO).
Function RegexReplace(ByVal text As String, _ ByVal replace_what As String, _ ByVal replace_with As String) As String Dim RE As Object Set RE = CreateObject("vbscript.regexp") RE.Pattern = replace_what RE.Global = True RegexReplace = RE.Replace(text, replace_with) End Function