Set regEx = New RegExp regEx.Global = True sourcestring = seourl regEx.Pattern = "[\W_]" replacementstring = "-" seourl = regEx.Replace(sourcestring,replacementstring)