Sub tests ()
Dim myString As the Variant, mt, mh, isr
Application. ScreenUpdating=False
The Set reg=CreateObject (" vbscript. Regexp ")
MyString="me capital: RMB 123656.00, lowercase: 123654.03 intermediary capital: RMB 800.36 company certificate capital: RMB 36659.32. Japan and South Korea on the crystal"
With reg
The Pattern="(? <=RMB capital:) \ d + [\ d] {1, 3}
"'the Pattern="\ d + (\. [0-9] {1, 2})"
The Global=True
The IgnoreCase=False
The MultiLine=True
The Set of mh=. The Execute (myString)
End With
For I=0 To mh. Count - 1
Isr=isr & amp; Mh (I). SubMatches (0) & amp; "
"Next
ActiveDocument. Content. The Text=isr
Application. ScreenUpdating=True
End Sub
. The Pattern="\ d + (\. [0-9] {1, 2})"
When test which can read the Numbers, only in the VBA. 00. 03, etc., not in front of an integer, but the test site test to read data
CodePudding user response:
Test (Sub)
Dim myString As the Variant, mt, mh, isr
Application. ScreenUpdating=False
The Set reg=CreateObject (" vbscript. Regexp ")
MyString="me capital: RMB 123656.00, lowercase: 123654.03 intermediary capital: RMB 800.36 company certificate capital: RMB 36659.32. Japan and South Korea on the crystal"
With reg
The Pattern="(RMB capital:) (\ d + \ [0-9] {1, 3})"
The Global=True
The IgnoreCase=False
The MultiLine=True
The Set of mh=. The Execute (myString)
End With
For I=0 To mh. Count - 1
Isr=isr & amp; Mh (I). SubMatches (1) & amp; "
"Next
ActiveDocument. Content. The Text=isr
Application. ScreenUpdating=True
End Sub
CodePudding user response:
Question, that is because the regular expression parser, you test the parser of the tool is more advanced, can explain the reverse matching, and vb and vba, VBS are older, such as the only support basic regular features, does not support & lt;=reverse match these new features,Don't you is to get the capital behind things, actually very simple, direct write: capital: \ d +/\ d {1, 3} is good ah,
The following can also be:
Capital: [\ d \] +
(? Capital:) : [\ d \] +
(? Capital:) : (/\ \ d +)
(? Capital:) : (/\ \ d +) \.?