i want print This is Hareesh only how many occurences that all will be print.
Const ForReading = 1
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Global = True
objRegEx.Pattern = "Hareesh"
objRegEx.Ignorecase = true
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Users\Hareesh\Desktop\From_Sampath\Test.txt", ForReading)
strSearchString = objFile.ReadAll
objFile.Close
Set colMatches = objRegEx.Execute(strSearchString)
If colMatches.Count > 0 Then
strMessage = "The following user accounts were found:" & vbCrlf
For Each strMatch in colMatches
msgbox strMessage
strMessage = strMessage & strMatch.Value & " (character position " & _
strMatch.FirstIndex & ")" & vbCrLf
Next
End If
Wscript.Echo strMessage