Heres my source. I don't understand why the text function works but
the object one does not. Can anyone help me?
regards,
Mike
<%
'this one works
response.write "<br>" & getSubmatchesText("this should hopefully match
and print eight words", "(\w)", TRUE, TRUE)
'this one doesn't work
Set submatches = getsubmatchesObject("this should hopefully match and
print eight words", "(\w)", TRUE, TRUE)
For i = 0 To submatches.Count - 1
response.write "<br>" & submatches(i)
Next
Function getsubmatchesObject(strText, pattern, isGlobal, ignoreCase)
Dim objRegExp
Set objRegExp = New RegExp
Dim objMatches, objMatch
'Set our pattern
objRegExp.Pattern = pattern
objRegExp.IgnoreCase = ignoreCase
objRegExp.Global = isGlobal
For Each objMatch in objRegExp.Execute(strText)
getsubmatchesObject = objMatch.SubMatches
Next
End Function
Function getSubmatchesText(strText, pattern, isGlobal, ignoreCase)
Dim objRegExp
Set objRegExp = New RegExp
Dim objMatches, objMatch
Dim data
'Set our pattern
objRegExp.Pattern = pattern
objRegExp.IgnoreCase = ignoreCase
objRegExp.Global = isGlobal
For Each objMatch in objRegExp.Execute(strText)
For i = 0 To objMatch.submatches.Count - 1
data = data & objMatch.SubMatches(i)
Next
Next
getSubmatchesText = data
End Function
%>
|