| Dim objFSO, objFile, colLines | | Dim objRegEx, objMatches, objMatch, aryMatches | | | | Const ForReading = 1 | | Const TristateTrue = -1 | | | | sFile = "a.txt" | | | | Set objFSO = CreateObject("Scripting.FileSystemObject") | | Set objFile = objFSO.OpenTextFile(sFile,1, false, -1) | | colLines = objFile.ReadAll | | objFile.Close | | | | Set objRegEx = CreateObject("VBScript.RegExp") | | objRegEx.Global = True | | objRegEx.IgnoreCase = True | | objRegEx.Pattern = "(\D*\.[a-z]*[0-9]*\.[a-z]*\.[a-z]+)[^a-zA-z]*(\w+:\/\/\d\.\w+\.\w+\.\w+\/\d\/\d\/\w\/\d\/\w*\d*\/\d*\/\w\/\d*\.\w{3})" | | Set objMatches = objRegEx.Execute(colLines) | | | | For Each objMatch in objMatches | | objMatch = Replace(objMatch, ".jpg','", " ") | | objMatch = "/Ref:abc /Rename:" & objMatch | | aryMatches = aryMatches & objMatch & vbCrLf | | Next | | | | Set strFile = objFSO.CreateTextFile("b.txt", True) | | strFile.Write aryMatches | | strFile.Close | | | | Set objFSO = Nothing | | Set objRegEx = NothingCOPY |
|