g***@gmail.com
2012-11-02 21:40:27 UTC
I'm sorry if this is the wrong place to ask this.
But I can't for the life of me find out why the following
colMatches object only has one item ?
I expect the following listing to produce:
Start Main Sub
2
abc
def
End Main Sub
and NOT
Start Main Sub
1
abc def
End Main Sub
------------------------
Option Explicit
Main
Sub Main
Wscript.Echo "Start Main Sub"
Dim re
Set re = New RegExp
re.pattern = "(abc) (def)"
re.Global = True
re.IgnoreCase = True
Dim colMatches
Dim strSource
strSource = "abc def"
Set colMatches = re.Execute(strSource)
Dim objMatch
Wscript.Echo colMatches.Count
For Each objMatch in colMatches
Wscript.Echo objMatch.Value
Next
Wscript.Echo "End Main Sub"
Wscript.Quit 0
End Sub
But I can't for the life of me find out why the following
colMatches object only has one item ?
I expect the following listing to produce:
Start Main Sub
2
abc
def
End Main Sub
and NOT
Start Main Sub
1
abc def
End Main Sub
------------------------
Option Explicit
Main
Sub Main
Wscript.Echo "Start Main Sub"
Dim re
Set re = New RegExp
re.pattern = "(abc) (def)"
re.Global = True
re.IgnoreCase = True
Dim colMatches
Dim strSource
strSource = "abc def"
Set colMatches = re.Execute(strSource)
Dim objMatch
Wscript.Echo colMatches.Count
For Each objMatch in colMatches
Wscript.Echo objMatch.Value
Next
Wscript.Echo "End Main Sub"
Wscript.Quit 0
End Sub