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 strMessage = strMessage & strMatch.Value & " (character position " & _ strMatch.FirstIndex & ")" & vbCrLf Next End If Wscript.Echo strMessage
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)