从字符串中删除除 a-zA-Z0-9 之外的所有特殊字符

Vis*_*rma 1 regex excel vba

有没有办法像Python中那样删除除a-zA-Z0-9之外的所有特殊字符:

((re.sub(r"[^a-zA-Z0-9]+", ' ', String)))
Run Code Online (Sandbox Code Playgroud)

由于我们可以使用正则表达式,因此下面是可以使用的 VBA 函数。

((re.sub(r"[^a-zA-Z0-9]+", ' ', String)))
Run Code Online (Sandbox Code Playgroud)

Pai*_*gWu 5

在 VBA 中,后期re绑定

Set re = CreateObject("vbscript.regexp")
Run Code Online (Sandbox Code Playgroud)

欲了解更多信息:https://msdn.microsoft.com/en-us/library/yab2dx62.aspx

更新:

您想要的功能可能类似于:

Set re = CreateObject("vbscript.regexp")
Run Code Online (Sandbox Code Playgroud)