Myreg2. The Pattern="\ s * (\ s +) award (\ s +)"
Myreg2. The Pattern="(\ w +) award (\ w +)"
Such as attendance third-class award second-class
Excel on the run in the face of the wrong, the following null values, but in the regular tester are both right, is this why?
Sub demo3 ()
Worksheets (1). Activate
Dim myreg1 As Object, myreg2 As Object, mymatch1 As Object
Dim mymc, mymatch2 As Object, k, mymatches1, mymatches2, mydata, I, j
I=6
The Set myreg1=CreateObject (" vbscript. Regexp ")
Myreg1. Global=True
Myreg1. The Pattern="name: \ s * (\ s +) \ s * awards: [[^;] +);"
The Set myreg2=CreateObject (" vbscript. Regexp ")
Myreg2. Global=True
Myreg2. The Pattern="\ s * (\ s +) award (\ s +)"
'myreg2. The Pattern="(\ w +) award) (\ w +"
Mydata=https://bbs.csdn.net/topics/Cells (1, 1). The Value
The Set mymatch1=myreg1. Execute (mydata)
For Each mymatches1 mymatch1 In
Mymc=mymatches1. Submatches (1)
The Set mymatch2=myreg2. Execute (mymc)
For Each mymatches2 mymatch2 In
MsgBox mymatches2. Submatches (0)
Next
Next
CodePudding user response:
\ w matching letters or Numbers or an underscore or equivalent to the Chinese characters' [^ A Za - z0-9 _] ',May be the reason for the \ w cannot match Chinese;
CodePudding user response:
Just now I turn in the right content: