vbscript func_reg

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vbscript func_reg相关的知识,希望对你有一定的参考价值。

Function reg1(reg_1, str_1)
    'exsample:
    'a1 = reg1("\/(.*?)\/", a0)
    'a2 = reg1("\/.*?\/(.*?)\\", a0)
    '---
    Set Regex2 = CreateObject("vbscript.regexp")
    With Regex2
        .Global = True
        .IgnoreCase = True
        .Pattern = reg_1
        Set matches2 = Regex2.Execute(str_1)
        If matches2.count = 0 Then
            reg1 = ""
        Else
            reg1 = matches2(0).submatches(0)
        End If
    End With
    Set Regex2 = Nothing
    Set matches2 = Nothing
End Function

Function reg_arr(reg_1, str_1)
    '获得的arr,从序号1开始取(即第2个),因0的位置(即第一个)为空
    Dim y
    str_spt = "@-@"
    Set Regex2 = CreateObject("vbscript.regexp")
    With Regex2
        .Global = True
        .IgnoreCase = True
        .Pattern = reg_1
        Set matches2 = Regex2.Execute(str_1)
'        reg_arr = matches2(0).submatches(0)
        For Each m In matches2
            y = y & str_spt & m.submatches(0)
        Next
        reg_arr = Split(y, str_spt)
    End With
    Set Regex2 = Nothing
    Set matches2 = Nothing
End Function

以上是关于vbscript func_reg的主要内容,如果未能解决你的问题,请参考以下文章

vbscript VBScript中

vbscript VBSCRIPT_EMAIL

vbscript SHA-256哈希的VBScript代码

vbscript 使用VBScript发送电子邮件

vbscript VBScript:运行本地或远程策略。

vbscript VBScript将可用磁盘空间写入文件