Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Global = True
objRegEx.Pattern = "abcd"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\f1.txt", 1)
strSearchString = objFile.ReadAll
objFile.Close
Set colMatches = objRegEx.Execute(strSearchString)
indx=colMatches.Count-1
ReDim arr(indx)
i=0
If colMatches.Count > 0 Then
strMessage = "The following numeric values were found :" & vbCrlf
For Each strMatch in colMatches
arr(i)=strMatch.value
msgbox arr(i)
i=i+1
' strMessage = strMessage & strMatch.Value & " (character position " & _
' strMatch.FirstIndex & ")" & vbCrLf
Next
End If
No comments:
Post a Comment