Set objFS = CreateObject("Scripting.FileSystemObject") Set objRE = New RegExp objRE.Pattern = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,4}" objRE.Global = True objRE.IgnoreCase = False objRE.MultiLine = True strFile = "file.txt" strFileContents = objFS.OpenTextFile(strFile).ReadAll Set colMatches = objRE.Execute(strFileContents) Dim Stuff, myFSO, WriteStuff, dateStamp dateStamp = Date() Set myFSO = CreateObject("Scripting.FileSystemObject") Set WriteStuff = myFSO.OpenTextFile("output.txt", 8, True) For Each objMatch In colMatches WriteStuff.WriteLine(objMatch.Value) Next