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