|
Sub 按钮4_Click()
Dim arr, brr(), k0
k0 = [a1].End(4).Row - 1
arr = [a2].Resize(k0, 1)
ReDim brr(1 To k0, 1 To 3)
Dim reg, k, mh, strA$, strB$
Set reg = CreateObject("vbscript.regexp")
reg.Pattern = "\((\d+\D+){0,3}\)"
reg.Global = True
For i = 1 To k0
strA = arr(i, 1)
k = 4: strB = ""
Do
strA = Replace(strA, strB, "")
Set mh = reg.Execute(strA)
If mh.Count > 0 Then
strB = mh(0).submatches(0)
If strB <> "" Then
k = k - 1
brr(i, k) = strB
End If
End If
Loop Until mh.Count = 0 Or strB = ""
Next
[b2].Resize(k0, 3) = brr
End Sub
正则取配套.zip
(9.99 KB, 下载次数: 201)
|
|