Update: I have gotten it to work if the replacement is just of one word. so if the word test is replaced by mouse and the only thing in the file is the word test, it works.
How can I replace like this:
CH_IPVOD_filename.mpg > replace the CH_IPVOD_ with nothing for the result of:
I would like to replace every instance of ch_ipvod_ with nothing.
Public Class Form4 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim fso, inputFile, outputFile Dim str As String Dim str1 As String Dim str2 As String Dim str3 As String fso = CreateObject("Scripting.FileSystemObject") inputFile = fso.OpenTextFile("c:\archive.txt", 1) str = inputFile.ReadAll str = str.Replace("CH_ipvod_", "") str1 = str.Replace("_t*.", ".") str2 = str1.Replace("_xSPA_", "_Spa_") str3 = str2.Replace(".ts", ".mpg") outputFile = fso.CreateTextFile("c:\archiveREPLACED.txt", True) outputFile.Write(str) outputFile.close() End Sub End Class
This post has been edited by PsychoCoder: 14 April 2010 - 01:14 PM
Reason for edit:: Code tags added