首页 > 其他 > 详细

Excel使用正则表达式

时间:2019-03-15 15:07:37      阅读:206      评论:0      收藏:0      [点我收藏+]

1、使用正则表达式提取子字符串

Function GetStr(ran As range, pattern As String)
    With CreateObject("VBScript.regexp")
        .Global = True
        .IgnoreCase = True
        .pattern = pattern
        
        If .Execute(ran).Count = 0 Then
            GetStr = "No match"
        Else
            GetStr = .Execute(ran)(0)
        End If

    End With

End Function

VBScript正则表达式语法参考

Excel使用正则表达式

原文:https://www.cnblogs.com/weixia-blog/p/10537008.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!