Well, in this specific case, I’d advise to better use ConvertToURL function instead of trying to replace parts of the string (with subsequent possible problems when the path would contain spaces and/or non-English characters).
Generally, possibly easiest is to use
Function Replace(str As String, strFind As String, strReplace As String) As String
Replace = Join(Split(str, strFind), strReplace)
End Function
… which is, as turned out, already implemented as ReplaceString
function of Tools standard library.
For using regular expressions in Basic, see here. Using com.sun.star.util.TextSearch service allows you to use regular expressions in search, but you need to do replacements manually.