Excel正则表达式VB提取字符串打开Excel,ALT+F11 打开VB
在sheet1 右键
正则表达式提取中文新建模块
贴⼊代码:
Function zz(rng As Range)
Dim reg As Object
Set reg = CreateObject("VBScript.RegExp")
With reg
.Global = True
.Pattern = "biz=([^&]+)&"
zz = .Execute(rng)(0)
End With
End Function
进⼊excel,sheet1中,调⽤ 函数即可。
Function zz(rng As Range)
Dim reg As Object
Set reg = CreateObject("VBScript.RegExp") With reg
.Global = True
.Pattern = "h[a-zA-z]+://[^\s]*"
zz = .Execute(rng)(0)
End With
End Function
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论