正则表达式

当前位置:正则表达式 > excel

excel正则表达式提取

自定义函数-正则表达式:
Function TQ(rng, types As String) As String
Dim obj As Object
Set obj = CreateObject(“VBSCRIPT.REGEXP”)
With obj
.Global = True
Select Case types
Case Is = “-hz” '去汉字
.Pattern = “[一-﨩]”
Case Is = “-zm” '去字母
.Pattern = “[a-zA-Z]”
Case Is = “-sz” '去数字
.Pattern = “[0-9.]”
Case Is = “+hz” '取汉字
.Pattern = “[^一-﨩]”
Case Is = “+zm” '取字母
.Pattern = “[^a-zA-Z]”
Case Is = “+sz” '取数字
.Pattern = “[^0-9.]”
End Select
TQ = .Replace(rng, “”)
End
WithEnd Function

相关文章
苏ICP备2022026517号-2  |   苏公网安备 32081202000316号
淮安先皓网络科技有限公司 © 版权所有  联系我们