'want to use regular expressions for data processing, but when debugging when the regular submatches said object is not applicable to this property or method, is this why?
To the result of the s and with regular editor, regular expressions should be to
Worksheets (" Sheet2 "). Activate
Dim s As String, myreg As Object, reg1 As Object, myreg1 As Object, I As an Integer
I=2
S=Worksheets (" Sheet3 ".) Cells (1, 1)
The Set myreg=CreateObject (" VBscript. Regexp ")
With myreg
The Global=True
. The Pattern="booking \ |. *? \ | (. *?) \ | (? :. *? \ |) {4} (. *?) \ | (. *?) \ | (. *?) \ | (? :. *? \ |) {19} (. *?) \ | (. *?) \ | (. *?) \ | ""
End With
The Set reg1=myreg. The Execute (s)
For Each myreg1 In reg1
Cells (I, 1)=reg1. Submatches (0)
Cells (I, 2)=reg1. Submatches (1)
Cells (I, 3)=reg1. Submatches (2)
Cells (I, 4)=reg1. Submatches (3)
Cells (I, 7)=reg1. Submatches (4)
Cells (I, 6)=reg1. Submatches (5)
Cells (I, 5)=reg1. Submatches (6)
I=I + 1
Next myreg1
CodePudding user response:
P1: reg1. Submatches (?) The fault?CodePudding user response:
Teacher teacher, is I write wrong, I have written reg1. Should be myreg1